rfPIC Serin problem


Closed Thread
Results 1 to 40 of 53

Hybrid View

  1. #1
    Join Date
    Nov 2007
    Posts
    9


    Did you find this post helpful? Yes | No

    Question

    I think I have the same problems with gavo. But currently I'm using assembly to do my programming. This rfPIC12f675 is different from other normal PICs where it has only one tris and gpio port. And the gpio reg is assigned to the pin itself.
    Can you kindly explain to me about how can I read in data serially using assembly? I'm sorry that I'm not really familiar with the code you pasted before.
    Can I just read in data bit by bit say into gp3 and then send it to gp2 for ASK modulation?
    Or can I just put or connect my digital input to gp2?

    I understand that the coding below is a Keeloq protocol

    ' Constants
    PreAmble CON $A5 ' 10100101 preamble
    Synch CON "~" ' 01111110 synch byte
    N4800 CON 188 ' 4800 bps
    N2400 CON 16780 ' 2400 bps
    GUARD CON 5 ' 5mS guard time pause

    As I'm not familiar with your coding, may I know what CON indicates and what N4800 CON 188 means?


    Thanks again for your help!

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    in PBP, CON is used to define a software constant, in asm it should looks like

    YourConstantVariable = .25

    or
    #DEFINE YourConstantVariable .25

    Using pre-defined constant here and there, allow to have a better readable code, and also allow to do some changes without having to scroll the whole code.

    For a 12F675 asm example.. well, first google hit gave me
    http://www.jbgizmo.com/page29.htm
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Nov 2007
    Posts
    11


    Did you find this post helpful? Yes | No

    Default stack overflow

    hi people,

    has anyone ever encountered a problem of stack overflow in their program?
    rite now im doing a program to transmit a stack of data which contain 16 bit + 64 bit +

    and the pic that im using is a pic12f675. what should i do to reduce this error?

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


    Did you find this post helpful? Yes | No

    Smile

    Hi Medusa,

    I had this problem once and it turned out to be a subroutine that had a GOTO at the end of it instead of RETURN. Changed the word--solved the problem.

    HTH,

    BobK

  5. #5
    Join Date
    Nov 2007
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    thanks bobk..i tried that, put return at the end of each goto instruction i have, but still it has not succeeded. is it possible due to overflow stack?

    my program is supposed to have a stack of 8 byte output excluding the preamble and header and timeguard.

    does anyone ever write a program that has a subroutine as follows

    read input from port GPIO
    move data from GPIO to 'input' register
    take only data from bit 1
    store the input (bit 1)to bit 0 at another register

    repeat for eight times

    what i already have in mind

    movfw GPIO
    movwf input
    movlw 0000 0000
    xorwf input,f
    goto rotate

    rotate
    rrf input,f
    rrf input,f

    anyone has any idea to continue?

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


    Did you find this post helpful? Yes | No

    Smile

    Hi Medusa,

    That's not what I meant. If you are calling a subroutine then at the end of the subroutine you put a RETURN. GOTO does not go at the end of a subroutine. This was the problem I had with one of my projects (18F452). The stack overflow was causing my project to hangup when it got to the subroutine after the stack overflowed. This was the only point I was trying to make.

    If you have both a GOTO and a RETURN then you might still be experiencing a problem.

    HTH,

    BobK

  7. #7
    Join Date
    Jun 2006
    Posts
    37


    Did you find this post helpful? Yes | No

    Default need help

    Hi Bruce!
    I have tried ur codes on RfPIC kit. i can see the data being sent by transmitter on GP2 and received on PORTC.1 on receiver side but the LED's are not blinking. what might be the problem.plz help me troubleshoot.
    thanks

  8. #8
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    That's hard to say. It works perfectly on my rfRXD0420 module installed in PICkit 1 board.

    Are you compiling the receiver code without any changes, and programming it into a
    PIC16F676 on the PICKit 1 board with the rfRXD0420 installed per the instructions?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  9. #9
    Join Date
    Jun 2006
    Posts
    37


    Did you find this post helpful? Yes | No

    Default

    Hi
    U have not included modedefs.bas in ur program.is that an issue?
    I did that but to no avail.
    maybe config fuses are causing something.they seem ok.they are as under when i read them using PICkit 1 software:
    12F675
    config word:0x31D4
    osccal: 0x3480
    bandgap: 0x3000

    12F676
    config word:0x31C4
    osccal: 0x3440
    bandgap: 0x3000

  10. #10
    Join Date
    Nov 2007
    Posts
    9


    Did you find this post helpful? Yes | No

    Default rfrxd0420

    Hi there,

    I've altered the receiver_demo program to suit my application. - I took in the data from rfRxd0420 drom RC2 and try to take it out serially from RC0 of the pic16f676 so that I can
    probe the data transmitted.

    Currently, I'm simulating the program using MPLAB IDE. Pardon me if I'm wrong.
    The receive_demo program that I understand, will check for header. But,
    it does says that if the data is high before 6ms, therefore the header is valid.
    What if the data is also 'LOW'?
    I'm actually having problems with simulation coz it does not want to
    come out of the loop - unless I put '1' in between.

    When it came out of the loop, I should be able to record that and then output that
    to the RC0 but it seems that the program didn't even jump to search for a guard time,
    instead it continue the process to find for high or low pulse.

    I just altered the receive demo of the dev kit. Can anyone help me please?
    Or do you suggest a better way to simulate this program?

    MAIN
    call CLOCK ; to update TRMLOW and TMRHIGH
    ; TMRLOW ~=4us TMRHIGH ~=1ms

    movlw HIGH STATEM
    movwf PCLATH
    movf STATECNTR, W ; Mask out the high order bits of
    andlw B'00001111' ; STATECNTR (a noise guard)

    addwf PCL, F ; The program clock (PCL) is incre-
    STATEM
    ; check for possible start of data stream
    goto BEGIN ; mented by STATECNTR in order
    goto BEGIN1 ; to go to the appropiate routine
    goto HEADER ; header is being ignored
    goto HEADER1 ; just count up the time and then takes the data
    goto HIGHPLSE ; times the width of Hi Pulse
    goto LOWPULSE
    goto RECORD ; record the 8 byte data
    goto WAIT4END ; wait for guard time to be greater than 8ms

    goto FIRST0 ; check whether DATA0 of bit 0 is 0 or 1
    call SENDOUT ; to send out the serial data out through portc pin 0
    goto RESET ; These RESET commands correct
    goto RESET ; erroneous values of STATECNTR
    goto RESET ; not caught by the mask above.
    goto RESET
    goto RESET
    goto RESET

  11. #11
    Join Date
    Nov 2007
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    from the demo program, they used ASK modulation which use NRZ format modulation.
    in this format, when the input is zero it would give you a pulse of 110 while if the input is one, it would give pulse 011, which means it will still give you pulse high for whichever input.

Similar Threads

  1. Serin Problem with 12F629/PBP
    By Flyingms in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 9th March 2009, 14:59
  2. Serin Problem 16f819
    By jjohannson in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd March 2007, 22:50
  3. Serin serout problem
    By lerameur in forum mel PIC BASIC Pro
    Replies: 336
    Last Post: - 6th February 2007, 04:25
  4. Problem with PBP interrupt and Serin, please help
    By rgregor in forum mel PIC BASIC
    Replies: 0
    Last Post: - 22nd August 2006, 19:02
  5. serout and serin problem
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th April 2006, 19:44

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