Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
raspberrypipico:pico_pio [2021/03/13 19:11] admin [pull(option)] |
raspberrypipico:pico_pio [2021/05/10 15:25] admin [Instantiate the StateMachine] |
||
---|---|---|---|
Line 51: | Line 51: | ||
**frequency** the frequency of the state machine, should be between 1000 and 125000000\\ | **frequency** the frequency of the state machine, should be between 1000 and 125000000\\ | ||
- | **GPIO pin** depending on the first on all following pins will be mapped (up to 32)\\ | + | **GPIO pin** depending on the first one, all following pins will be mapped (up to 32)\\ |
INPUT: in_base (sets input pins) | INPUT: in_base (sets input pins) | ||
sm = StateMachine(0, | sm = StateMachine(0, | ||
Line 152: | Line 152: | ||
| | ||
- | ====wait()==== | + | ====wait(option)==== |
- | Pauses | + | **wait(// |
- | | + | It will waits until the specified GPIO has the specified polarity.\\ |
- | irq(block, rel(0)) | + | - polarity (0=LOW, 1=HIGH)\\ |
+ | - num (absolute GPIO number)\\ | ||
+ | | ||
+ | **wait(// | ||
+ | It does the same like before, but it uses the pin mapping.\\ | ||
| | ||
- | FIXME | + | **wait (// |
+ | It will wait for an irg to be set.\\ | ||
+ | - polarity (1 clears the interrupt flag, 0 won' | ||
+ | - num (interrupt number, with rel the relative interrupt numbers could be used)\\ | ||
+ | |||
+ | | ||
- | ====in(source, | + | ====in(source, |
The IN instructor shifts data from the source into the input shift register (ISR).\\ | The IN instructor shifts data from the source into the input shift register (ISR).\\ | ||
**source: | **source: | ||
Line 167: | Line 176: | ||
- status (from special register could e.g. indicate FIFO empty or full)\\ | - status (from special register could e.g. indicate FIFO empty or full)\\ | ||
- osr (from output shift registers)\\ | - osr (from output shift registers)\\ | ||
- | **bitcount:**\\ | + | **bits:**\\ |
- 0-31 bits\\ | - 0-31 bits\\ | ||
- | ====out(destination, | + | ====out(destination, |
The OUT instructor shifts data from the output shift register (OSR) to the destination.\\ | The OUT instructor shifts data from the output shift register (OSR) to the destination.\\ | ||
**destination: | **destination: | ||
Line 180: | Line 189: | ||
- pc (shifts an instruction into the program counter)\\ | - pc (shifts an instruction into the program counter)\\ | ||
- isr (into the input shift registers)\\ | - isr (into the input shift registers)\\ | ||
- | **bitcount:**\\ | + | **bits:**\\ |
- 0-31 bits\\ | - 0-31 bits\\ | ||
Line 226: | Line 235: | ||
mov(osr, x) #copy the x scratch register to the output shift register | mov(osr, x) #copy the x scratch register to the output shift register | ||
- | ====irq(option, | + | ====irq(option, |
The IRQ instruction sets or clears an interrupt flag.\\ | The IRQ instruction sets or clears an interrupt flag.\\ | ||
**option**\\ | **option**\\ | ||
- | - set, nowait (default option, set flag without clear)\\ | + | - set, nowait (default option, set flag without clear first)\\ |
- | - wait (wait until the flag is zero)\\ | + | - wait (wait until the flag is zero before setting it)\\ |
- clear (clears the flag)\\ | - clear (clears the flag)\\ | ||
- | **irq_num**, numer of the interrupt 0-7\\ | + | **num** number |
- | **_rel** relative IRQ number, can set different IRQ per StateMachine, | + | **rel** relative IRQ number\\ |
In the StateMachine | In the StateMachine | ||
| | ||
Line 270: | Line 279: | ||
| | ||
====nop()==== | ====nop()==== | ||
- | The NOP instruction stands for no operations. | + | The NOP instruction stands for no operations. |
- | nop (31) #delay 31 cycles | + | nop () [31] #delay 31 cycles |
====wrap()==== | ====wrap()==== | ||
Line 316: | Line 325: | ||
---- | ---- | ||
- | ===== Simple Audio Out===== | ||
- | | ||
- | | | ||
- | | ||
- | |------ Audio Out | ||
- | | ||
- | | | ||
- | | ||
- | ---- | ||
- | ==== Resistor DAC ==== | ||
- | |||
- | |||
- | ---- | ||
===== Knowledge ===== | ===== Knowledge ===== | ||
[[https:// | [[https:// |