Simple But Nothing


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1

    Default Simple But Nothing

    This has to be something basic I'm missing.

    I'm at a loss as to why this RCVR doesn't function...I get nothing on the PORTB outputs. I can see the data from the transmitter which I have hardwired to the rcvr pic SERIN port A0. I can see the switches going on and off.

    The transmitter is sensing switches on PORTA with 10k pulldowns to ground.
    Input high = switch on (and rcvr portb high)

    I'm using Micro code studio and have chosen the 16F628A.

    Heres the code exactly...

    PAUSE 2000

    DEFINE OSC 4
    INCLUDE "modedefs.bas"
    CMCON = 7 'PORT A ALL I/O
    TRISA = %11000001 'A0 IS SERIN A6 A7 XTAL
    TRISB = %00000000 'ALL OUTPUTS

    SWITCH VAR BYTE
    QUALA VAR BYTE
    QUALB VAR BYTE
    SWITCH = 0
    QUALA = %11001111
    QUALB = %11010101

    START:

    SERIN PORTA.0,N1200,[QUALA,QUALB],SWITCH

    PORTB.0 = SWITCH.0
    PORTB.1 = SWITCH.1
    PORTB.2 = SWITCH.2
    (AND SO ON)

    GOTO START

    In the Epic software I have... 16F628A--XT--WDT on--PWRUP on--MCLR as
    input--BROWN OUT on

    Thanks kindly for your help.

  2. #2
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Michael
    This has to be something basic I'm missing.

    I'm at a loss as to why this RCVR doesn't function...I get nothing on the PORTB outputs. I can see the data from the transmitter which I have hardwired to the rcvr pic SERIN port A0. I can see the switches going on and off.

    The transmitter is sensing switches on PORTA with 10k pulldowns to ground.
    Input high = switch on (and rcvr portb high)

    I'm using Micro code studio and have chosen the 16F628A.

    Heres the code exactly...

    PAUSE 2000

    DEFINE OSC 4
    INCLUDE "modedefs.bas"
    CMCON = 7 'PORT A ALL I/O
    TRISA = %11000001 'A0 IS SERIN A6 A7 XTAL
    TRISB = %00000000 'ALL OUTPUTS

    SWITCH VAR BYTE
    QUALA VAR BYTE
    QUALB VAR BYTE
    SWITCH = 0
    QUALA = %11001111
    QUALB = %11010101

    START:

    SERIN PORTA.0,N1200,[QUALA,QUALB],SWITCH

    PORTB.0 = SWITCH.0
    PORTB.1 = SWITCH.1
    PORTB.2 = SWITCH.2
    (AND SO ON)

    GOTO START

    In the Epic software I have... 16F628A--XT--WDT on--PWRUP on--MCLR as
    input--BROWN OUT on

    Thanks kindly for your help.
    I believe you have to add a 'wait' statement for quala and qualb.

    PORTB.0 = SWITCH.0
    PORTB.1 = SWITCH.1
    PORTB.2 = SWITCH.2

    What is the above?
    Is it supposed to be
    'IF switch = 0 then
    portb.0 = 1'
    ???

  3. #3


    Did you find this post helpful? Yes | No

    Default

    I have other software that works fine without a wait in it...that's not to say it "should be there".....learning is a neverending process with Picbasic because there are no decent learning guides.

    IE...I just bought the Chuck Helebuyck book and it says nothing more than anything else I've read.

    I could write it both ways....

    if switch.0 = 1 then
    portb.0 = 1
    else
    portb.0 =0
    endif

    BUT again, I have software I've written for the 16c65b that woks just fine
    with...

    portb.0 = switch.0

  4. #4
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373


    Did you find this post helpful? Yes | No

    Default

    I still don't understand. The way you have it written, SWITCH is a variable you are getting from your SERIN routine?? So, I will assume that you are setting a bit on the transmit side on say...portb. Then you are reading portb, and sending it as a variable. On the receive side just make PORTB = SWITCH.

    Now open the PBP manual and look up SERIN. There should be an example of a wait statement. If not, use SERIN2. Copy it verbatim and do not substitute "[" for "(" or vice versa. If you don't, don't be at a loss why it does not work. These things are fussy about syntax.

    Ron

  5. #5


    Did you find this post helpful? Yes | No

    Default

    yes switch is a variable (switch contacts on xmtr)

    like I say, the software as I have shown....

    SHOULD WORK

    why it doesn't has me perplexed.

    switch or switch.0 same thing....may be redundant but that's not what I need to know.

  6. #6
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hi Michael,

    I thought I had an idea but I didn't read enough of the datasheet.

    BobK
    Last edited by BobK; - 22nd February 2006 at 03:34.

Similar Threads

  1. Simple RF remote control code
    By Bruce in forum Code Examples
    Replies: 13
    Last Post: - 22nd January 2014, 10:45
  2. Simple Blinking LED - WTF!!
    By johnnylynx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 1st February 2010, 06:19
  3. Simple LCD code not working!...WHY?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 29th November 2009, 19:48
  4. Replies: 0
    Last Post: - 2nd February 2009, 23:23
  5. Replies: 4
    Last Post: - 7th September 2005, 14:11

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