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

    well that works for both of them
    the four leds are funvtionning good on both circuits.

    k
    Last edited by lerameur; - 5th December 2006 at 12:55.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur
    well that works for both of them
    the four leds are funvtionning good on both circuits.

    k

    You have a PIC16F88 on the transmitter and a PIC16F628A on the receiver, yes?

    When you push the button on each PIC, the LEDs cycle thru on their respective PICs with each button press, yes? (remember, 2 seperate circuits running independant programs, not tied together except for the fact they happen to be mounted to the same workbench).

    If they do, change the pause 50 to pause 1000. When you hold the button down, the LEDs should increment once a second. That will verify that the oscillator is running at the correct speed (or at least close to it).

    I just want to make sure this is all work before we got any farther (small steps).

    JDG

  3. #3
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    I have two Pic16F88 ( did try a PIC16F628A once to see what would happen, how did you know, I dont think I mentioned that)

    both circuits are running independently, Just the power supply is hooked up in parallel. Two circuits, two breadboards. two are doing the same thing


    k
    Last edited by lerameur; - 6th December 2006 at 02:35.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur
    I have two Pic16F88 ( did try a PIC16F628A once to see what would happen, how did you know, I dont think I mentioned that)

    both circuits are running independently, Just the power supply is hooked up in parallel. Two circuits, two breadboards. two are doing the same thing


    k
    Ok, I'm back. I don't think you did specifically mention you had a 16F628A except that it was in one of the headers of one of your files somewhere.

    So, you've got 2 16F88's, one will eventually be a transmitter (TXPIC), one will eventually be a receiver (RXPIC).

    Right now, both PICs right now have 4 LEDS and a push button. When you fire it up, the leds do their little power up check, then when you push the button, the leds light up in sequence about once per second.

    Release the button, the sequence stops until you hit the button again right?

    If that's correct, now we'll connect the 2 PICs, define one as TXPIC and and as RXPIC.
    On the TXPIC side:
    Select a pin for serial output. I suggest RB2.

    -------------------------------------
    Add:
    txout var portb.2
    output txout
    dataout var byte

    near the beginning of your TXPIC program, next to the rest of the variable declarations
    --------------------------------------

    -------------------------------------
    And add:
    dataout = ledcount
    serout txout, n2400, [ dataout ]
    pause 100

    on the line after 'ledcount = ledcount + 1', but before the 1st endif
    ---------------------------------------




    On the RXPIC side:
    Select a pin for serial input. I suggest RB5.

    -------------------------------------
    Add:
    rxin var portb.5
    input rxin
    datain var byte

    near the beginning of your RXPIC program, next to the rest of the variable declarations
    --------------------------------------


    ------------------------------------
    Change your RXPIC code to this (starting at mainloop):

    mainloop:
    serin rxin, n2400, 5000, nodatarx, datain
    'if no data received in 5 seconds, jump to nodatarx

    if datain = 0 then 'all leds off
    led1 = 0 : led2 = 0 : led3 = 0 : led4 = 0
    endif

    if datain = 1 then '1st led on
    led1 = 1 : led2 = 0 : led3 = 0 : led4 = 0
    endif

    if datain = 2 then '2nd led on and so on and so on down the line....
    led1 = 0 : led2 = 1 : led3 = 0 : led4 = 0
    endif

    if datain = 3 then
    led1 = 0 : led2 = 0 : led3 = 1 : led4 = 0
    endif

    if datain = 4 then
    led1 = 0 : led2 = 0 : led3 = 0 : led4 = 1
    endif

    goto mainloop

    nodatarx: 'flash the leds 3 times
    led1 = 0 : led2 = 0 : led3 = 0 : led4 = 0
    led1 = 1 : led2 = 1 : led3 = 1 : led4 = 1
    pause 400
    led1 = 0 : led2 = 0 : led3 = 0 : led4 = 0
    pause 400
    led1 = 1 : led2 = 1 : led3 = 1 : led4 = 1
    pause 400
    led1 = 0 : led2 = 0 : led3 = 0 : led4 = 0
    pause 400
    led1 = 1 : led2 = 1 : led3 = 1 : led4 = 1
    pause 400
    led1 = 0 : led2 = 0 : led3 = 0 : led4 = 0
    goto mainloop

    END
    ----------------------------------------



    Connect the PortB.2 pin on the TXPIC to the PortB.5 pin on the RXPIC, and write/burn the programs.
    This should make the TXPIC and RXPIC act in their respective roles. You push a button on the TXPIC, it sends a code to the RXPIC. Both sets of LEDs on both PICs should match. If you don't send a code for 5 seconds the RXPIC will flash the LEDs 3 times, then turn them all off. The next time you press the button on the TXPIC, the same leds should be on for both the TXPIC and RXPIC.

    Try it out, see what happens....
    JDG

  5. #5
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Ok, I tried it, everything is fine, its working, The four leds flashes if no data from sending chip after 5 seconds, everything like you said.

    ken

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur
    Ok, I tried it, everything is fine, its working, The four leds flashes if no data from sending chip after 5 seconds, everything like you said.

    ken


    GREAT!!! That's great news. I'm at work at the moment. I'll post a bit more in a few hours when I get some spare time.
    JDG

  7. #7
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    thanks alot, I wont be home till late again today so no hurry.
    I just tried putting it through the RF module just to see what would happen, but it was not going through nicely.
    Waiting for your next instruction.

    k

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