Differences
This shows you the differences between two versions of the page.
projects:icspio [2015/01/11 17:41] darron [Demo] |
projects:icspio [2017/01/12 22:44] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== ICSP I/O ==== | ||
- | |||
- | ICSP I/O is a protocol and group of functions designed | ||
- | to quickly develop test code for the devices supported | ||
- | by [[: | ||
- | |||
- | It uses the I/O lines used by the ICSP programming | ||
- | protocol and is compatible with bit-bang programmers such as | ||
- | the Velleman K8048. | ||
- | |||
- | ICSP I/O was not designed a replacement for more established | ||
- | and more reliable protocols but it can be used for prototyping. | ||
- | |||
- | === Licence === | ||
- | |||
- | ICSP I/O is licensed under same terms as [[: | ||
- | |||
- | === Install === | ||
- | |||
- | < | ||
- | hg clone http:// | ||
- | cd pickles | ||
- | make | ||
- | make install | ||
- | </ | ||
- | |||
- | === Usage === | ||
- | |||
- | < | ||
- | # | ||
- | # | ||
- | # | ||
- | # | ||
- | # | ||
- | NPINS | ||
- | # | ||
- | </ | ||
- | |||
- | Internal variable addresses are assigned at the current CBLOCK address. It is up to | ||
- | the main source file to ensure that this address is both valid and that there is enough space for allocation. | ||
- | |||
- | The include files are located in / | ||
- | |||
- | === Demo === | ||
- | |||
- | == Set LEDs and read switches in a loop == | ||
- | < | ||
- | ptest 5 ARG | ||
- | </ | ||
- | |||
- | == Set LEDs and read switches from the command line == | ||
- | < | ||
- | pio CMD ARG | ||
- | </ | ||
- | |||
- | === Functions ==== | ||
- | |||
- | == GETBYTE == | ||
- | Fetches a byte from the master (host) and stores it in BUFFER.\\ | ||
- | Sets W and also sets the carry bit on error (time-out, protocol or | ||
- | parity error). | ||
- | |||
- | == SENDBYTE == | ||
- | Sends a byte in W to the master (host).\\ | ||
- | Sets W and also sets the carry bit on a time-out error. | ||
- | |||
- | == SENDACK == | ||
- | Calls SENDBYTE with W=ACK (acknowledge) | ||
- | |||
- | == SENDNAK == | ||
- | Calls SENDBYTE with W=NAK (negative acknowledge) | ||
- | |||
- | 2 levels of stack are used when calling the routines GETBYTE, SENDBYTE or | ||
- | SENDTERM. On 12-bit word architecture devices do not call any of these | ||
- | routines from within a sub-routine since it will overflow the stack. | ||
- | |||
- | === Protocol ==== | ||
- | |||
- | PGD is used for data I/O with even parity and PGC for clock synchronisation. | ||
- | PGC is unidirectional and is only controlled by the master (host), this is the | ||
- | slave. The interface may or not be inverted but this is catered for by the | ||
- | k8048 Microchip PIC programmer BITRULES inversion logic. | ||
- | |||
- | Data is setup on the master prior to a clock low to high transition and setup | ||
- | on the slave after a clock low to high transition. Data is read after a clock | ||
- | high to low transition on both master and slave. | ||
- | |||
- | Start and stop bits have data held low and high respectively and if invalid | ||
- | then a protocol error is flagged and the transaction terminated without further | ||
- | communication on either end. Parity error causes a similar closure of the | ||
- | session. | ||
- | |||
- | < | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | </ | ||
- | |||
- | 1 start bit, 8 data bits, even parity and one stop bit. The data line is | ||
- | normally held high since in order to operate bi-directionally data output must | ||
- | be held high in order for data input to operate with the Velleman K8048. | ||
- | |||
- | === Reference === | ||
- | |||
- | ^Arch. ^Stack level| | ||
- | | 12 | 2 | | ||
- | | 14 | 8 | | ||
- | | 16 | 31 | | ||
- | |||