Navtex Receiver


Closed Thread
Results 1 to 18 of 18

Thread: Navtex Receiver

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Here's a tips on how to mix ASM and PBP.
    Code:
            '    Using PIC16F88
            @ DEVICE INTRC_OSC, LVP_OFF, WDT_OFF, MCLR_OFF
            
            DEFINE OSC 4
            OSCCON=%01101000
            ANSEL=%00000000
            CMCON=%00000111
            
            trisa = %11111111
            trisb = %00000001
        
            DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
            DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
            DEFINE HSER_SPBRG 25  ' 9600 Baud @ 4MHz, 0.16%
            DEFINE HSER_CLROERR 1 ' Clear overflow automatically
                
            CounterA    var byte BANK0
            CLEAR
            
    Start:
            asm
                    CHK?RP PORTB
                    BTFSC   PORTB,0
                    GOTO $-1
                    INCF _CounterA,F
            ENDASM                
            HSEROUT ["CounterA=",DEC CounterA,13,10]
            PAUSE 200
            GOTO START
    You define your variable in PBP, then you access them in ASM. Possible to use the other way... BUT not 100% sure if this is safe though... sure it isn't 'cause you can't know for sure where PBP will place it's own variables.
    Last edited by mister_e; - 1st April 2008 at 20:49.
    Steve

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

  2. #2
    Join Date
    Feb 2005
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    Thanks for your reply mister_e. Tomorrow i will try in PBP and i will tell you my results.

  3. #3
    Join Date
    Feb 2005
    Posts
    44


    Did you find this post helpful? Yes | No

    Default TMR0 to interrups every 1msec

    i am using darrel's interrupts and 20MHz crystal. With mister_e calculator i found that i want prescaler 1:32 and preload 99 into tmr0.I don't know how to preload the value into timer.below i have the interrupt routine of my program. Is this correct for preload the value?


    '---[TMR0 - interrupt handler]--------------------------------------------------
    Tick0: ;every 1ms occurs

    ;make space for new sample
    cp_old=cp_new ;save old value
    cp_new.highbyte=CCPR1H ;take new capture
    cp_new.lowbyte=CCPR1L
    gosub samplebit ;take the sample bit

    TMR0=99

    @ INT_RETURN

    thanks

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


    Did you find this post helpful? Yes | No

    Default

    if you're still using the 16F876 and want to have an interrupt each ~1mSec.. then yes.

    Easy huh?
    Steve

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

  5. #5
    Join Date
    Feb 2005
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    Thanks mister_e.it was very easy to be true. I would like to ask you what is in your timer calc the re-load variable because i can't understand it.

    thanks again for you reply.

    regards

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


    Did you find this post helpful? Yes | No

    Default

    If you know how much clock instruction cycle it takes to reload your timer, you set Reload (instr. cycle) (some call it fudge factor) with this value to fine tune your Preload results.

    If you don't know AND/OR don't need 100% accuracy, just forgive it

    I understand how and why i'd place it there... but the language barrier stop me today... Darrel, Bruce, someone?
    Last edited by mister_e; - 13th April 2008 at 21:58.
    Steve

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

Similar Threads

  1. Replies: 17
    Last Post: - 12th April 2014, 02:17
  2. 433 Mhz Data Receiver
    By Pesticida in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 29th November 2010, 02:26
  3. RC Servo Receiver
    By Ioannis in forum General
    Replies: 2
    Last Post: - 23rd October 2007, 06:56
  4. PIC16F877 with GPS receiver
    By rocketqueen in forum GPS
    Replies: 10
    Last Post: - 15th November 2006, 21:56
  5. interfacing gps receiver with 16f877a
    By sakhyvava in forum GPS
    Replies: 1
    Last Post: - 27th September 2006, 09:13

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