Christopher4187
- 16th October 2005, 21:17
Hi,
I used this program on a 16F876 and it worked with no problem. I went to a 16F688 because I just needed a PIC with a USART port and less pins. Below is the code but it stops at the point where HSEROUT is. Can anyone help with it?
DEFINE HSER_BAUD 2400
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
DEFINE HSER_CLROERR 1
Define ADC_BITS 10 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
ADCON1 = %10000010
TRISC = %11000010
TRISA = %11011111
ANSEL = %10000000
CMCON0=7
b1 var BYTE
b2 var BYTE
b3 var BYTE
sum var word
mainloop:
IF PORTC.1=0 THEN SEND
GOTO MAINLOOP
send:
B1=0
B2=1
B3=0
sum = b1+b2+b3
HIGH PORTC.2
PAUSE 100
LOW PORTC.2
HIGH PORTC.0
pause 50
HSEROUT [0,b1,b2,b3,sum.byte0] <---This is where the code stops.
PAUSE 50
LOW portC.0
HIGH PORTC.2
PAUSE 1000
LOW PORTC.2
B1=0
B2=0
B3=0
GOTO MAINLOO
I used this program on a 16F876 and it worked with no problem. I went to a 16F688 because I just needed a PIC with a USART port and less pins. Below is the code but it stops at the point where HSEROUT is. Can anyone help with it?
DEFINE HSER_BAUD 2400
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
DEFINE HSER_CLROERR 1
Define ADC_BITS 10 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
ADCON1 = %10000010
TRISC = %11000010
TRISA = %11011111
ANSEL = %10000000
CMCON0=7
b1 var BYTE
b2 var BYTE
b3 var BYTE
sum var word
mainloop:
IF PORTC.1=0 THEN SEND
GOTO MAINLOOP
send:
B1=0
B2=1
B3=0
sum = b1+b2+b3
HIGH PORTC.2
PAUSE 100
LOW PORTC.2
HIGH PORTC.0
pause 50
HSEROUT [0,b1,b2,b3,sum.byte0] <---This is where the code stops.
PAUSE 50
LOW portC.0
HIGH PORTC.2
PAUSE 1000
LOW PORTC.2
B1=0
B2=0
B3=0
GOTO MAINLOO