Do I need a pause?


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1

    Default Do I need a pause?

    Hello,
    while sending data from pic to pic (16F628A) through an rf link,Linx rxm-418-lc modules, all but one thing is working good. I have also done a hard wired connection from pic to pic with the same problem. I am using the checksum that Bruce recommended and I am using manchester. I am making an output on portb come on with the button pressed and with the button on the tx released it goes off. However, frequently an output stays on. Press the button again and it will clear. This is the clip from my program:

    IF mydata1=%01011001 THEN PAUSE 10
    IF mydata1=%01011001 THEN
    HIGH 1
    ELSE
    LOW 1
    ENDIF

    goto loop

    I added a PAUSE 50 after LOW 1 but no change.

    When I go back to the main loop I've added mydata1=%00000000 before going to the SERIN to make sure that the previously received mydata1 is clear instead of using CLEAR although I've tried that to.

    Does anyone have any suggestions?

    By the way, I have checked the tx side to make sure the button was closed, even listened to the datastream on my service monitor.
    Last edited by tazntex; - 20th August 2008 at 03:28.

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818

    Default

    Hi Tazntex,
    I really do not get what you are trying to do here with this:
    Code:
    IF mydata1=%01011001 THEN PAUSE 10
    IF mydata1=%01011001 THEN
    Here is my thinking, you have received the data, done deal, stored it in a variable named mydata, and now you expect it to somehow bounce? Bounce delays are for mechanical switches. I do not see it hurts nor do I see any benefit to including it. It just slows down and bloats your code. Since this is another new thread, refresh us on what this code does not do and what it does do. As written it asks a true / false question, does mydata = 01011001, if yes it pauses 10 and asks again, if true then it procedes to turn 1 high if false it turns 1 low. If mydata is not 01011001 it will always execute the else. If you have a pin to spare why not send a debug or serout with the contents of mydata to a terminal or serial lcd and be sure of the contents?
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3

    Default

    Thanks for the reply. I see your point about checking twice but I just wanted to check twice, the first brings me into this and the second does the if/then. I've taken this out and now I have:

    IF mydata1=%01011001 THEN
    HIGH 1
    ELSE
    LOW 1
    ENDIF

    I had a previous previous thread "else" which you help me on and it is all working but like I said before, I press a button on the tx ,the outputs being portb.0-6 on the rx , the momentary outputs 1-4 come on and when I release the button they go off. Every so often one stays on, check the selected output pin with scope and it is high, but if I press and release the same button for the output again it will go back low. I do not have a serial LCD but you mentioned using terminal, what do you mean using a PC??? If so, would you tell me how ?

    Thanks
    Last edited by tazntex; - 20th August 2008 at 15:31.

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818

    Default

    Quote Originally Posted by tazntex View Post
    Thanks for the reply. I see your point about checking twice but I just wanted to check twice, the first brings me into this and the second does the if/then. I've taken this out and now I have:

    IF mydata1=%01011001 THEN
    HIGH 1
    ELSE
    LOW 1
    ENDIF

    I had a previous previous thread "else" which you help me on and it is all working but like I said before, I press a button on the tx ,the outputs being portb.0-6 on the rx , the momentary outputs 1-4 come on and when I release the button they go off. Every so often one stays on, check the selected output pin with scope and it is high, but if I press and release the same button for the output again it will go back low. I do not have a serial LCD but you mentioned using terminal, what do you mean using a PC??? If so, would you tell me how ?

    Thanks
    download realterm, works well, use a max 232 if needed, some nice kits on ebay for cheap,gets you a PCB, connector, caps and the max chip. Or roll your own, use the code from post 16 of this thread:http://www.picbasic.co.uk/forum/showthread.php?t=4972 here is an ebay seller http://cgi.ebay.com/RS232-Serial-UAR...QQcmdZViewItem
    and another http://cgi.ebay.com/MAX232-RS232-Ser...QQcmdZViewItem
    Last edited by Archangel; - 20th August 2008 at 22:49.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818

    Default

    Quote Originally Posted by tazntex View Post
    Thanks for the reply. I see your point about checking twice but I just wanted to check twice, the first brings me into this and the second does the if/then. I've taken this out and now I have:

    IF mydata1=%01011001 THEN
    HIGH 1
    ELSE
    LOW 1
    ENDIF

    I had a previous previous thread "else" which you help me on and it is all working but like I said before, I press a button on the tx ,the outputs being portb.0-6 on the rx , the momentary outputs 1-4 come on and when I release the button they go off. Every so often one stays on, check the selected output pin with scope and it is high, but if I press and release the same button for the output again it will go back low.
    So if I understand correctly, you only want the lights on WHILE receiving mydata=%01011001
    HIGH 1 otherwise you WEND want it to stay Low, Correct ?
    Last edited by Archangel; - 20th August 2008 at 23:31.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6

    Default

    "So if I understand correctly, you only want the lights on WHILE receiving mydata=%01011001
    HIGH 1 otherwise you WEND want it to stay Low, Correct?"

    yes that is correct.

    One thing though, I checked the circuit to make sure that is was the processor keep the led on and the output pin is High, while checking the pin I just wanted to make sure that the voltage coming from the output was correct, it is. Looking at the same pin with the scope there is some noise, so I switched from a switch mode power supply to a gel cell (12v). I am using a 7805 regulator with 10uf electrolytic on the input and .01 disc on the regulators output to ground. The noise is still there. Perhaps a cap between the VCC and Vss of the Pic will clear up the rest. I have change processors on both the tx and rx side to rule out a defective one just in case static damage them. On the 4mhz crystal I am using 33pf caps to ground.

    I will explore realterm tommorrow, thanks for that info.

    Thanks again

  7. #7
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818

    Default

    Try something like this:
    Code:
    IF mydata1=%01011001 THEN
    WHILE  mydata1=%01011001
    HIGH 1
    WEND
    ELSE
    LOW 1
    ENDIF
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. Delayed output 10 secs
    By lilimike in forum mel PIC BASIC Pro
    Replies: 37
    Last Post: - 14th October 2011, 06:28
  2. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  3. Replies: 11
    Last Post: - 12th July 2008, 02:36
  4. Fade out LEDs question
    By Sam in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 22nd June 2008, 10:50
  5. Help Quick Need to make code smaller
    By Programmednew in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 25th January 2005, 03:46

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