read values from gpio pins wake up the main processor share data between the ulp co-processor and the main processor and then we'll write values out to gpio pins we'll do a simple blink sketch that runs entirely on the ulp processor now there are some advanced use cases including reading from the adc and i squared c devices that we'll cover in future videos so we'll get started after this quick word about the channel sponsor pcb way they've been sponsoring the channel for a while now and we've built a few pcbs with them we'll be making some more pcbs in the future videos as i want to learn a bit more about keycad they also do NUMBER_TOKENd printing and cnc work check out the link to pcb way in the description so what is this ulp code processor thing anyway the expressive docs describe it as the following the ultra low power code processor is a simple finite state machine which is designed to perform measurements using the adc temperature sensor and external i squared c sensors while the main processors are in deep sleep mode now although they describe it as a simple finite state machine it's slightly easier to think of it as a very basic low power processor that can run code even when the main processors are asleep the ulp processor does not run all the time you schedule it to run with a set time period it runs and then when the ulp program completes it stops running until the next scheduled time to program the ulp we use some simple assembly language don't let this put you off it really is very simple and not something to be afraid of if you're using arduino then there's also a very basic c compiler that you can use the ulp coprocessor has four NUMBER_TOKEN-bit general purpose registers labeled rNUMBER_TOKEN rNUMBER_TOKEN rNUMBER_TOKEN and rNUMBER_TOKEN it also has an extra NUMBER_TOKEN-bit register called stage count which can be used to implement loops and has some special instructions it may help to imagine these registers as variables in a normal c program there are NUMBER_TOKEN instructions in total i've tried to group these into logical areas there are three instructions for getting values into our registers the move instruction will move a value from one register to another or it will load an immediate value into a register the store instruction will store the contents of a register into a memory address contained in another register with an optional signed offset the load instruction does the opposite it reads from the contents of memory from an address in a register with an optional signed offset as well we have two arithmetic instructions add and sub as the name suggests these instructions let you add and subtract values we can either add or subtract registers or we can add and subtract numbers from registers we also have a set of bitwise operators and or logical shift left and logical shift right these all behave in the same way as the bitwise operators in c and c plus we then have three jump commands we have the absolute jump command this can jump to an address in a register or to an immediate address it also supports two conditions eq which will be true if the last alu operation resulted in a zero or ov which will be true if the last alu operation resulted in an overflow in this
START_SPONSOR_TOKEN so we'll get started after this quick word about the channel sponsor pcb way they've been sponsoring the channel for a while now and we've built a few pcbs with them we'll be making some more pcbs in the future videos as i want to learn a bit more about keycad they also do NUMBER_TOKENd printing and cnc work check out the link to pcb way in the description END_SPONSOR_TOKEN