Serout problem


Closed Thread
Results 1 to 40 of 95

Thread: Serout problem

Hybrid View

  1. #1
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    I had time to analyze the code:
    A few questions came up:
    For the ledtoggle, why would you want to bit the pin high to low and then put it high, why not put it high right away. The way you have it, if its high, you put it to low, then to high, there must be a reason why and its flying 100 feet over my head.
    Also, the led will stay on until you call the ledsoff right?
    as far as the manchester coding goes, I understand, but there is decoder done here, you are simply pointing the coded values to their function. right?

    k

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur
    I had time to analyze the code:
    A few questions came up:
    For the ledtoggle, why would you want to bit the pin high to low and then put it high, why not put it high right away. The way you have it, if its high, you put it to low, then to high, there must be a reason why and its flying 100 feet over my head.
    Also, the led will stay on until you call the ledsoff right?
    as far as the manchester coding goes, I understand, but there is decoder done here, you are simply pointing the coded values to their function. right?

    k

    LedToggle --- It's not the way describe it.
    Read the IF...ELSE....ENDIF statement... work it through in your head.
    If it's on, turn it off, otherwise turn it on (implying that it was off in the first place).

    Encoder/Decoder - yes, I am assuming you don't have either the encoder or the decoder in the circuit. As far as I'm concerned, you don't need it. Yes, it's a handy piece of hardware to have around. The sooner you figure out how to do things without it, the better.

    JDG

  3. #3
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    HI

    I was not refering to the hardware encoder and decoder.
    The program I have below works, but always gives me zero on the lcd.
    k
    By the way , the command gosub trainreceiver :... gives an eror while compiling , wrong Label..


    X VAR BYTE 'VARIABLE TO incoming VALUE
    pause 100
    mainloop:
    X =0
    serin PORTB.3,n2400,[X]
    Lcdout $fe, 1, "Value in: ", dec X
    pause 100
    Goto mainloop
    End
    Last edited by lerameur; - 3rd December 2006 at 20:37.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur
    HI

    I was not refering to the hardware encoder and decoder.
    The program I have below works, but always gives me zero on the lcd.
    k
    By the way , the command gosub trainreceiver :... gives an eror while compiling , wrong Label..


    X VAR BYTE 'VARIABLE TO incoming VALUE
    pause 100
    mainloop:
    X =0
    serin PORTB.3,n2400,[X]
    Lcdout $fe, 1, "Value in: ", dec X
    pause 100
    Goto mainloop
    End



    Now, what are you trying to do here....Make LEDs light up on command or make an LCD work.

    If you can't make LEDs do what you want them to, when you want them to do it, how do you expect to make an LCD work correctly?

    When you get a good hack on your priorities, let me know, I'm not going anywhere.

    Until then, start with the basics and work your way up...

    And as far as your program not working, you've got a 100ms pause between checking the serin. Get rid of the pause and use the timeout. If you get a timeout, no data has been received. If you don't get a timeout, you probably got some data. A 100ms is too long of a time to be missing characters. The receiver doesn't store them for you until you're ready to take them.

    (On another note, the trainreceiver gosub, try putting that above the main program, but below the setup, it should work correctly then, unless I had a typo or something)

    JDG

  5. #5
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    I am putting an LCD to see what is coming in to be able to troubleshoot the problem , since the led dont work, I would like to see what is coming in portb.3. Sonce its giving me a value of zero, I guess my command serin is not interpretting the incoming code right.
    I just tried the following code. I realized that with 'serin' command the loop would stop at the first iteration. Now with serin2 , the led blinks, so the loops keeps going. The value coming in at portb.3 is erronous when ever it flashes once in a while on the lcd screen ( at least the erronous values are between 0 and 250). AND i get the same signal in and out on the oscilloscope
    if i dont get $55, $aa.. on the lcd screen , I suppsoe I wont be getting any leds turned on
    k

    mainloop:
    X =0
    serin2 PORTB.3,n2400,[X]
    Lcdout $fe, 1, "Value in: ", dec X

    Goto mainloop
    End
    Last edited by lerameur; - 3rd December 2006 at 21:13.

  6. #6
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    By the way I tried your code, led led lights at startup once, then i cannot get any leds to light. this is the reason why I thought it would be good to see what was going on with an LCD

    k
    Last edited by lerameur; - 3rd December 2006 at 21:52.

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    how about your config fuses?

    Any Schematic?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 21:58
  2. Serout to serial servo
    By azmax100 in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 12th August 2009, 17:46
  3. Advice-scrutiny for my serial controller
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th December 2008, 18:11
  4. Strange SerOut Problem
    By masosi in forum mel PIC BASIC Pro
    Replies: 39
    Last Post: - 23rd April 2007, 07:06
  5. Replies: 11
    Last Post: - 13th July 2005, 20:26

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