Hi,
Not known to be working but here goes....
Oh, you do use an external X-tal, not the internal OSC, right?
First we need to set the pins to digital (datasheet section 4.2.1):
Code:
ANSEL = 0 'Turn off analog inputs.
Then we need to turn off the comparators (datasheet Register 7.1):
Code:
CMCON = 7 'Turn off all comparators.
Now set PortC.1 as input and PortC.3 as output (datasheet section 4.3):
Code:
TRISC.1 = 1 'PortC.1 (pin9) as input
TRISC.3 = 0 'PortC.3 (pin7) as ouput
Then set up OSC, variables etc and then the rest:
Code:
DEFINE OSC 20 'Or whatever your X-tal is....
LED var PortC.3 'LED connected here
S_In var PortC.1 'Pin for serial INPUT
dat var byte 'Storage for received data
Main:
SerIn2 S_in, 16780, [wait("k"), dat]
Gosub blink
pause 50
goto main
Blink:
High LED
Pause 50 'Just made the pulse a little longer here
Low LED
Return
Now make SURE you program your STAMP or other PIC to send data at 2400 baud, inverted, no parity. And that you only send two bytes, first the ASCII representation of "k" and then your "dat" variable.It's been a long time since I used any of the STAMP's so I can't help you there.
That's about the best I can do without actuall hardware to test with. If it works, great! If it doesn't, don't say I didn't try.
I did see in one of you earlier posts that you had S_In and S_Out set to the same PIC pin. Is it supposed to be like that or is that an error?
By the way, pullup are when you connect a pin to the supply rail via a resistor and pulldown when you connect a pin to ground via a resistor. Some of the PIC pins have internal pullups that can be turned on and off. The 16F688's have internal pullups on PortA (except PortA.3) that you can turn on or off by configuring the WPUA register. (Datasheet section 4.2.2). PortC does not have internal pullups on the 16F688.
/Henrik Olsson.
PS. Sorry you're pissed off but you have to understand that nobody here is obligated to help anybody. We are all here on our free time and we all have our own projects, work, life, other hobbies etc.
Bookmarks