I have changed the code to use USART, things have progressed, LED at PortA.0 toggles every second, BUT there is constant voltage on the TX PIN. Rx works fine as it is connected to my computer via MAX232. So whenever I send an OK from my computer the toggling of the led is delayed for 3 seconds appx.
I do not see "AT" on my terminal window
Code:
PAUSE 10
'-----------------------------------------------------
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
DEFINE HSER_SPBRG 25 ' 2400 Baud @ 4MHz, 0.17%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
@ ERRORLEVEL -306
'------------------------------------------------------
ADCON1=7
CMCON=7
INTCON=128
OPTION_REG.7=0
TRISA=0 : PORTA=0
TRISB=0 : PORTB=0
TRISC=%10000000 : PORTC=0
TRISD=0 : PORTD=0
TRISE=0 : PORTE=0
CCP1CON=0
'-----------------------------------------------------
main:
TOGGLE PORTA.0
HSEROUT ["AT",13,10]
HSERIN 1000,main,[WAIT("OK")]
PAUSE 2000
goto main
Bookmarks