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

    1. What hardware do you have? List the PICs, the crystals, the LEDs, the TX, the RX, the switches, the pot, etc. and so and so....
    Pic16F88, 20Mhz crystals, Led out on portA.0,1,2 and 3
    MCRL on PORTA.5, ground pin, Vdd on 5v. NO pot, no switch, Just a wire going from PortB3 (output of serout) going to portA.4 (serin)
    if serin.. well
    START:
    B0 =0
    serout portB.3,n2400, [ $0F, $0F, $0F, $0F, $0F, $0F, $0F ]
    serin portA.4,n2400, [B0 ]
    if (B0 = $0F) then
    porta.2 =1
    pause 100
    porta.2 =0
    else
    goto start
    endif
    GOTO START

    2. What is your 'master plan'? Do you intend to transfer data between 2 PICs wirelessly? Do you intend to just control a couple of LEDs wirelessly? What?
    I want to transfer data to about 200feet between two pics.

    Go back to my web site, I posted a picture of the circuit
    thanks for your time
    ken

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur
    1. What hardware do you have? List the PICs, the crystals, the LEDs, the TX, the RX, the switches, the pot, etc. and so and so....
    Pic16F88, 20Mhz crystals, Led out on portA.0,1,2 and 3

    2. What is your 'master plan'? Do you intend to transfer data between 2 PICs wirelessly? Do you intend to just control a couple of LEDs wirelessly? What?
    I want to transfer data to about 200feet between two pics.

    ken
    Ok, still a lot of information missing. Is the 16F88 your transmitter or receiver PIC? You posted what I assume is the 'transmitter' code, what about the receiver hardware and/or code...in fact, don't worry about the code for right now. We're going to make sure your hardware is hooked up right.
    (P.S. I'm only going to be here for the next 1/2 hour, until 10pm CST)


    And another thing, you are using a software based serial solution, also called 'bit-banging'. By the time your serout is done, all the data is transmitted. It's not buffered anywhere. It's not done in hardware. It's like trying to use 2 telephones to talk to yourself in different rooms. You talk into one phone, run to the other room and wait for your voice to come out. It isn't going to happen. Serin doesn't have anything to do but wait for nothing. Not going to work....
    Last edited by skimask; - 5th December 2006 at 04:30.

  3. #3
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    well from what you said before:
    5. Make sure the button works...in other words, you push it and an LED connected to the same PIC on a different pin lights up on software command

    I went real simple as you told me.
    So this pic is the only pic, emitting AND receiving, the yellow wire is from sending to receiving.

    k

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur
    well from what you said before:
    5. Make sure the button works...in other words, you push it and an LED connected to the same PIC on a different pin lights up on software command

    I went real simple as you told me.
    So this pic is the only pic, emitting AND receiving, the yellow wire is from sending to receiving.

    k


    Not going to work. See last thread I posted.
    JDG

  5. #5
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    just posted the unworking program ,
    nothing is coming out of the sending chip
    Last edited by lerameur; - 5th December 2006 at 04:48.

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur
    just posted the unworking program ,
    nothing is coming out of the sending chip

    I know nothing is working on your sending chip...you've got it set up wrong. Read my words a couple of posts ago. Going out of the chip back into the chip isn't going to work.

    Plug this into your sending chip, with only the LEDs and a button attached to portb.0 with a pulldown resistor:

    -------------------------------------------------------------------------
    INCLUDE "modedefs.bas"
    DEFINE OSC 20 'use external 20mhz crystal
    CMCON = 7 : ANSEL = 0 : ADCON1 = 7

    ledcount var byte

    led1 var porta.0 : output led1 'led on porta.0
    led2 var porta.1 : output led2 'and so on...
    led3 var porta.2 : output led3
    led4 var porta.3 : output led4

    key var portb.0 : input btn 'push button on portb.0
    '1K-10K resistor from portb.0 to ground (pulldown)
    'push button is wired between portb.0 and +5v

    led1 = 1 : pause 500 : led1 = 0 'initial light up to see if program is running
    led2 = 1 : pause 500 : led2 = 0
    led3 = 1 : pause 500 : led3 = 0
    led4 = 1 : pause 500 : led4 = 0

    mainloop:

    if key = 0 then 'button not pressed
    goto mainloop
    endif
    if key = 1 then
    pause 50 'wait 50ms for switch to debounce then check again
    if key = 1 then 'if it's still pressed, then increment the count
    ledcount = ledcount + 1
    endif
    endif

    if ledcount = 0 then 'all leds off
    led1 = 0 : led2 = 0 : led3 = 0 : led4 = 0
    endif
    if ledcount = 1 then '1st led on
    led1 = 1 : led2 = 0 : led3 = 0 : led4 = 0
    endif
    if ledcount = 2 then '2nd led on and so on and so on down the line....
    led1 = 0 : led2 = 1 : led3 = 0 : led4 = 0
    endif
    if ledcount = 3 then
    led1 = 0 : led2 = 0 : led3 = 1 : led4 = 0
    endif
    if ledcount = 4 then
    led1 = 0 : led2 = 0 : led3 = 0 : led4 = 1
    endif
    if ledcount = 5 then 'reset led count, roll it back to 0
    ledcount = 0 'and turn leds off since count is back to 0
    led1 = 0 : led2 = 0 : led3 = 0 : led4 = 0
    endif

    goto mainloop

    END




    Forget about serial code, the LCD and anything else that isn't listed above. Just do what's listed, and nothing else. If you go off on a tangent somewhere else, I don't know where you're going. Just do this. Get this to work. Then do the same basic thing on the receiver PIC. Get them both to work. We'll worry about connecting the 2 after both of these work.
    All this program is going to do is make the LED lights walk about 5 times a second as long as you hold the button down.
    JDG

  7. #7
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Ok I am going to do this, I will read and analyze your code before asking anything
    I'm off to bed now,
    thanks and see ya

    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