serin Bug on PIC16f688?


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    May 2006
    Posts
    19


    Did you find this post helpful? Yes | No

    Angry

    I'm getting a little pissed now! Why is nobody helping me? i asked a question (what are pullups and how do i enable internal pullups) that most of the people here can answer BUT NOBODY DOES. AND WHY IS ONE OF THE MOST BASIC FUNCTIONS (SERIN) NOT WORKING????? i know it must be a simple answer BUT I CAN'T figure it out alone... (i never had any lessons in electronics or uC programming becouse i'm still at highschool)

    does it have anything to do with ANSEL or TRISC?
    can anyone post or send me a WORKING code for a 16f688 that uses SERIN(2)

  2. #2
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Thumbs down

    OK, you are pissed ?????

    1.
    Use your brain !

    2.
    The sender works to fast! He sends maybe the lowbyte of the word "dat" followed by "kk".
    The receiver waits for one "k" and receives another byte. wrong order ?
    Then the LED is 10ms on.

    3.
    Using software-UART paused by blinking and waiting needs a very slow sender with pauses between the characters.

    4.
    Use Hardware-UART inside a Interrupt-routine.
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  3. #3
    Join Date
    May 2006
    Posts
    19


    Did you find this post helpful? Yes | No

    Angry

    I'm still pissed, and BigWumpus is an perfect example why:

    Quote Originally Posted by BigWumpus
    The sender works to fast! He sends maybe the lowbyte of the word "dat" followed by "kk".
    in this case "dat" is the boudrate. i tried every single boudrate between 16000 and 20000 because i thought there may be a timing problem. (it didn't work)

    Quote Originally Posted by BigWumpus
    wrong order ?
    Then the LED is 10ms on.
    I WISH IT WAS ON because then it would have received a "k" and it would have PASSED the serin2 code. like i said before many times IT NEVER BLINKS.

    Quote Originally Posted by BigWumpus
    Using software-UART paused by blinking and waiting needs a very slow sender with pauses between the characters.
    I also tried the code
    Code:
    serIn2 S_in ,16780,[wait("k")]
    on my pic in combination with
    Code:
    do
    SEROUT 10,16780, ["k"]
    pause 1000
    loop
    on my stamp. i think that 1 second between the characters may be enough. (i also said this before) if i switch the codes (with a few little changes) from pic to stamp and otherwise THEN my stamp will pass the serin code if my pic sends a "k" and blink. WHY doesn't the stamp --> pic version work?



    PLEASE read my post before you reply and say i'm stupid. This is a little part of my LPS project that WON the school price with over 300 students that also made projects, i'm also nominated for the National price. so i'm not stupid BUT i don't have any teachers or other people that can help me with problems like this and this is my FIRST project with picbasic EVER so i may not know some very basic things (like internal pullups). Just keep that in mind before you post...

  4. #4
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    chriroz,

    Quote Originally Posted by BigWumpus
    "Use your brain !
    That does not mean you are stupid.

    You should not take it personal.

    One thing I wonder is that "
    Quote Originally Posted by chriroz
    ...i don't have any teachers or other people that can help me with problems like this...
    How do they evaluate your project then?

    ---------------------------------------
    Last edited by sayzer; - 10th November 2006 at 10:39.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  5. #5
    Join Date
    May 2006
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sayzer
    How do they evaluate you project then?
    well this is only a small part of my project and they can understand the code (that's not very hard) but they cant make it up.

  6. #6
    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.

  7. #7
    Join Date
    May 2006
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Thanks a lot. i'm gona test it right now.
    and that pissed of thing was because everyone told and asked me things i already posted and that costs me an other day and i didn't had much time to fix it. Ill let you know if it works

  8. #8
    Join Date
    May 2006
    Posts
    19


    Did you find this post helpful? Yes | No

    Talking

    YEAH!!!!! IT WORKS finally after 2 weeks of trying it works
    HenrikOlsson's code worked except for
    Code:
    CMCON = 7    'Turn off all comparators.
    it gave me an undefined symbol 'cmcon' error but after some searching i saw that
    Code:
    POKE $19, 7
    would do the same thing
    and it did
    THANK YOU SO MUCH!! (HenrikOlsson, you don't mind I put your name in my project references?)

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