Gday,
I am using serial communicator that is with microcode studio. I cant see a setting to ensure it is sending ascii. I made sure it was not sending cr and it made no diference.
The code I am using is below.
NCLUDE "modedefs.bas" ' Include serial modes
SI VAR PORTB.1 ' Serial Input pin
B0 VAR BYTE
Define OSC 10
Define LCD_DREG PORTA ' RA0..3
Define LCD_DBIT 0
Define LCD_RSREG PORTA ' RA6
Define LCD_RSBIT 6
Define LCD_EREG PORTA ' RA4
Define LCD_EBIT 4
Define LCD_BITS 4
TRISA = 0
TRISB = 0
CMCON = 7
Pause 1000 ' Wait for LCD to startup
duty VAR BYTE ' Duty cycle value (CCPR3L:CCP3CON<5:4>)
TRISB.3 = 0 ' Set PORTB.5 (CCP3) to output
CCP1CON = %00001100 ' Set CCP3 to PWM
T2CON = %00010101 ' Turn on Timer2, Prescale=4
PR2 = 155 ' Set PR2 to get 1KHz out
duty = 100 ' Set duty cycle to 20%
loop:
SerIn SI,T9600,,duty
if duty > 625 then
LCDOut $FE,1 ' Clear LCD screen
LCDOut "Duty to great" ' Display line 1
goto loop
endif
CCP1CON.4 = duty.0 ' Store duty to registers as
CCP1CON.5 = duty.1 ' a 10-bit word
CCPR1L = duty >> 2
'duty = duty + 5 ' Increase duty cycle
LCDOut $FE,1 ' Clear LCD screen
LCDOut # duty ' Display line 1
GoTo loop ' Do it forever
Any other ideas why it is not receiving the same as I send it?
Thanks,
Ben
Bookmarks