John Andrews of Microchip has contributed his code for makeing the 17C756 into a very nice little multi-purpose IO device with an easy serial command interface. You can monitor and change registers, port pins, A2D, Capture channels and PWM, send and recieve data to / from I2C and EEPROM all with text commands from USART1.
See the listings as well.
Run Time Communications: Connect to USART1 ASCII Terminal settings Baud: 9600 Data bits: 8 Parity: none Stop bits: 1 Flow Control: none The following Commands are available in PICos 1.04 COMMAND ACTION -------------- ------------------------------- <ENTER> Null command (should see prompt "PICos>") MSG:str<ENTER> Display the string message on USART1 VER<ENTER> Display PICos version ANn<ENTER> Read A/D channel n (n = 0 - 11, demo board requires n = 0 - 3) T<ENTER> Read Thermister (on AN4) REGx:x=x<ENTER> Write a hexidecimal value to bank:register REGx:x<ENTER> Read value in bank:register and display in hexidecimal format PORTDD=n<ENTER> Write decimal value to PORTD (n = 0 - 255) PORTDD<ENTER> Read value on PORTD and display in decimal format (n = 0 - 255) PORTDX=n<ENTER> Write hexidecimal value to PORTD (n = 00h - FFh) PORTDX<ENTER> Read value on PORTD and display in hexidecimal format (n = 00h - FFh) PORTD=n<ENTER> Write hexidecimal value to PORTD (n = 00h - FFh) PORTD<ENTER> Read value on PORTD and display in hexidecimal format (n = 00h - FFh) PWM1=n<ENTER> Write PWM1 Duty cycle as a percentage 'n' of the period (n = 0 - 100) PWM2=n<ENTER> Write PWM2 Duty cycle as a percentage 'n' of the period (n = 0 - 100) PWM1 <ENTER> Read PWM1 Duty cycle as a percentage of the period (n = 0 - 100) PWM2 <ENTER> Read PWM2 Duty cycle as a percentage of the period (n = 0 - 100) PWM2+=n<ENTER> Increase PWM2 Duty cycle by percentage 'n' of the period (n = 0 - 100) PWM2-=n<ENTER> Decrease PWM2 Duty cycle by percentage 'n' of the period (n = 0 - 100) CAPn<ENTER> Measure capture value on channel n = 1 or 2 I2CADDR=n<ENTER> Write value n to the I2C slave address (n = 00h - 7Fh) I2CADDR<ENTER> Read I2C slave address (n = 00h - 7Fh) I2Cn<ENTER> Read byte at I2C address (n = 00h - 7Fh) I2Cn=x<ENTER> Write value x at I2C address (n = 00h - 7Fh, x = 00h - FFh) EEn<ENTER> Read byte at EEPROM address n (n = 00h - FFh) EEn=x<ENTER> Write byte with value x at EEPROM address n (n = 00h - FFh, x = 00h - FFh) S@EEn<ENTER> Read string starting at EEPROM address n (n = 00h - FFh) S@EEn=str<ENTER> Write string 'str' starting at EEPROM address n (n = 00h - FFh, str = a string upto 40 characters) I2Cn:str<ENTER> Write the PICos command 'str' to I2C slave address 'n' (n = 00h - 7Fh, str = PICos command) I2Cn:<ENTER> Read a string from I2C slave address 'n' (n = 00h - 7Fh)
Questions:
Interested:
Comments: