Quote Originally Posted by Joe S. View Post
From mr_e's PIC MULTICALC . . .
Code:
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_SPBRG 92  ' 2400 Baud @ 3.579MHz, 0.21%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
Okay. Below is my new code (I've added an LED to port b.6). Here's what happens. A capital 'A' shows on the terminal window, the LED goes on, the LED then goes out, another 'A' shows on the terminal, the LED goes on and there is where it stays. I never touched the keyboard during this time. After this process, it doesn't matter what I type in the terminal window, the light stays on and nothing else happens. Any thoughts?


Include "modedefs.bas"

DEFINE OSC 3

define HSER_RCSTA 90h
define HSER_TXSTA 24h

DEFINE HSER_SPBRG 92
DEFINE HSER_CLROERR 1


OSCCON= $08


'this is the layout for portb.5 - RB5/AN11/RX/DT

'turn off analog input for port b.5
ANSELH=0
'and any other analog stuff
ANSEL=0

'there's several analog comparators - lets shut them off
'I dont know which one - shut them all off

CM1CON0 =0
CM2CON0 =0
CM2CON1 =0

adcon1=0
'now set it for input
trisb.5 = 1
trisc.0 =1


rxPin VAR portB.5
txPin VAR portB.7
rxVal Var Byte
txVal Var Byte


loop:
pause 1000
'serout txPin,T2400,["A"]
hserout ["A"]
Pause 1000
High Portb.6
Pause 1000
'Low portb.6
hserin [rxVal]
'serin rxPin,T2400,rxVal
'pause 500
'serout txPin,T2400,[rxVal]
hserout [rxVal]
Low portb.6
pause 1000
goto loop
end