Compile problems


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2007
    Posts
    2

    Default Compile problems

    I'm having some trouble getting this code to compile a friend of my wrote it but does not have time to help me with it. he used a compiler from ohsonsoft

    I don't know enough about pbp or assembly to get it to work, so any help would be great.

    I'm told PBP does not run fast enough for this code and it has to be done in ASM???

    '(96 bursts of 16 cycles @ 56kHz) at 1800Hz
    'Osc at 16Mhz
    'PIC16F628A
    cnt var Byte '96 pulse counter
    sixt var Byte '16 cycle counter
    start:
    cnt = 96
    TRISB = %00100000 'RB5 as trigger input
    PORTB = 0x00 'RB0 as IR output, RB1 as 1800 Hz test output
    PR2 = 26 'timer 2 compare for 56kHz 1/2 period
    T1CON = %00000000 '1:1 prescale TMR1 off
    T2CON = %00000000 '1:1 prescale TMR2 off
    trigger:
    @ btfss portb,5 'wait for trigger RB5 = 1
    Goto trigger
    'debounce code goes here if required
    @
    sixt = 16
    PORTB = 0x02 'set 1800Hz output pin on
    @ movlw 0x01 'bit for toggling output RB0
    @ bsf T2CON,TMR2ON 'turn on TMR2
    pulseon:
    @ xorwf portb,f 'toggle RB0 IR output
    @ clrf TMR2
    pwaiton:
    @ btfss PIR1,TMR2IF 'wait for TMR2 flag
    Goto pwaiton
    @ bcf PIR1,TMR2IF 'clear TMR2 flag
    @ nop
    @ nop
    @ nop
    pulseoff:
    @ xorwf portb,f 'toggle RB0 IR output
    @ clrf TMR2
    pwaitoff:
    @ btfss PIR1,TMR2IF 'wait for TMR2 flag
    Goto pwaitoff
    @ bcf PIR1,TMR2IF 'clear TMR2 flag
    @ nop
    @ decfsz sixt,f 'count cycles
    Goto pulseon
    @ clrf portb 'else clear outputs
    @ bcf T1CON,TMR1ON 'turn off TMR1
    TMR1H = 0xfb 'time interval for 1800Hz 1/2 period
    TMR1L = 0xd0 '(2^16 - 277.7*4) - 18*4 - 28*4 adjustments
    @ bcf pir1,tmr1if 'clear TMR1 flag
    @ bsf T1CON,TMR1ON 'turn on TMR1
    @ bcf t2con,tmr2on 'turn off TMR2
    killtime:
    @ btfss pir1,tmr1if 'wait for TMR1 flag
    Goto killtime
    @ bcf pir1,tmr1if 'clear TMR1 flag
    @ bcf T1CON,TMR1ON 'turn off TMR1
    @ decfsz cnt,f 'count down 96 pulses
    Goto top 'if not output 96 yet
    Goto start 'else return to await next firing


    Thanks for looking
    Clinton.

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


    Did you find this post helpful? Yes | No

    Smile

    Hello Clinton,

    I don't know if you are aware that there are quite a few variations of the Basic language for PICs. OshonSoft's is different from MELabs which is what this forum is for. I would suggest you check out www.oshonSoft.com and see if they have a forum that might be able to help you. There also may be someone on this forum that uses both PBP here and the variation from OshonSoft that hasn't seen this post yet. OshonSoft's big claim is their simulator that allows you to see how your program will run on a PC display with an IDE for around $20.00.

    Keep checking this site to see if someone is able to help you. Good luck in your venture!

    BobK

  3. #3
    Join Date
    Jun 2007
    Posts
    2


    Did you find this post helpful? Yes | No

    Default

    Thanks for the info.

    I'm hoping to get it to work under MELabs so i can use it in some of my existing programs...

    Clinton.

Similar Threads

  1. Unable to pass a variable to LCDOUT without getting compile errors
    By Ferroto Baggins in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th February 2010, 16:43
  2. Compile and Program help using PICKit2
    By ozarkshermit in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 10th March 2009, 14:51
  3. 18F2620 compile problems in PBP
    By Joe Rocci in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 13th August 2006, 10:11
  4. 16F819 compile problems
    By George in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th March 2006, 00:22
  5. Replies: 2
    Last Post: - 9th February 2006, 22:03

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