serin Bug on PIC16f688?


Results 1 to 13 of 13

Threaded View

  1. #10
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default

    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.
    Last edited by HenrikOlsson; - 10th November 2006 at 14:17. Reason: Defenition of pull-up/down needed clarifying.

Similar Threads

  1. PIC16f877 code crosses boundary @800h
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th April 2009, 22:03
  2. serin question?
    By sachymo in forum General
    Replies: 5
    Last Post: - 27th July 2008, 10:04
  3. BUG IN PBP 2.50 & 2.50A pic16F688 ??
    By FRANCISCOGIM in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 12th June 2008, 02:42
  4. Problem with PBP interrupt and Serin, please help
    By rgregor in forum mel PIC BASIC
    Replies: 0
    Last Post: - 22nd August 2006, 19:02
  5. SerIn and SerOut
    By Dwayne in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 21st July 2004, 15:54

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts