Still Experimenting


Closed Thread
Results 1 to 3 of 3

Hybrid View

  1. #1

    Default Still Experimenting

    Is there any way when I send my data to the receiver I need it recognize that I am still pressing the switch and hold an output high but once the switch is released the output is to go low? Here is my receiver code:

    Serial receiver
    INCLUDE "bs2defs.bas"
    @ DEVICE PIC16F628a,XT_OSC
    @ DEVICE pic16F628a, WDT_OFF ' Watchdog Timer
    @ DEVICE pic16F628a, PWRT_ON ' Power-On Timer
    @ DEVICE pic16F628a, MCLR_ON ' Master Clear Options (Internal)
    @ DEVICE pic16F628a, BOD_ON ' Brown-Out Detect
    @ DEVICE pic16F628a, LVP_OFF ' Low-Voltage Programming
    @ DEVICE pic16F628a, CPD_OFF ' Data Memory Code Protect
    @ DEVICE pic16F628a, PROTECT_OFF
    DEFINE OSC 4
    mydata var byte
    serpin var porta.1
    dgood var porta.2
    porta=0
    portb=0
    trisa = %00000010
    trisb = %00000000
    CMCON=7
    PAUSE 50

    loop:
    gosub loop1
    if mydata > 0 then dgood=1
    if mydata = 0 then dgood=0
    if mydata =%01010110 then rly1
    if mydata <>%01010110 then low 7

    if mydata =%01011001 then rly2
    if mydata <>%01011001 then Low 6

    if mydata =%01011010 then rly3
    if mydata <>%01011010 then low 5

    if mydata =%01100101 then rly4
    if mydata <>%01100101 then low 4

    if mydata =%01100110 then rly5
    if mydata <>%01100110 then low 3

    if mydata =%01101001 then rly6
    if mydata =%01101010 then rly7
    if mydata =%10010101 then rly8
    goto loop
    rly1:
    high 7
    pause 100
    goto loop
    rly2:
    HIGH 6
    pause 100
    goto loop
    rly3:
    HIGH 5
    pause 100
    goto loop
    rly4:
    HIGH 4
    pause 100
    goto loop
    rly5:
    HIGH 3
    pause 50
    goto loop
    rly6:
    toggle 1
    pause 100
    goto loop
    rly7:
    toggle 0
    pause 100
    goto loop
    rly8:
    toggle 2
    pause 100
    goto loop

    loop1: SERIN serpin,N2400,[254],mydata
    return
    End

  2. #2
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by tazntex View Post
    Is there any way when I send my data to the receiver I need it recognize that I am still pressing the switch and hold an output high but once the switch is released the output is to go low? Here is my receiver code:
    Think yourself thru the code...
    Code:
    If I'm still receiving a code that a switch is pressed, hold the output high and check again
    If I'm not receiving the code mentioned above, put the output low and check again
    Simple as that...

  3. #3

    Default

    Well, I'm about to pull all the hair out of my head. I've tried several things including something like this:
    rly1:
    if mydata=%00000000 then high 7
    pause 250
    IF mydata<>%00000000 then low 7
    goto loop
    Still no go and the next loop:
    rly2:
    HIGH 6
    pause 250
    Low 6
    goto loop
    of course while I pressing the button down on the transmitter rly2 just goes on/off,etc.
    I've been going through the compiler manual again trying to figure out what I am missing. Any more tips? Thanks

Similar Threads

  1. Experimenting with the PicBasic Pro Compiler
    By polymer52 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 17th May 2016, 19:17
  2. Replies: 7
    Last Post: - 17th May 2016, 19:03
  3. Replies: 2
    Last Post: - 8th March 2009, 22:32
  4. UPS serial protocol
    By sougata in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 5th November 2006, 02:49
  5. Experimenting With Pic Basic Pro Question
    By jabahunter in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 28th May 2005, 08:16

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