Shop OBEX P1 Docs P2 Docs Learn Events
Trying to modify Phil's Bell 202 object — Parallax Forums

Trying to modify Phil's Bell 202 object

OldFartRadiomanOldFartRadioman Posts: 30
edited 2013-11-30 08:15 in Propeller 1
I am wanting to change several things
Initially just need to get transmit to work
Change mark tone from 2200 Hz to 1800 Hz; - I think I have that one figured out
Send no start or stop bits, just the 8 data bits per byte
send no initial marking bits - which sould be simple but is not working
I thought I could just remove the " call #send1" in the xmtlp loop but that results in seeing a data burst about every two minutes
Tried replacing with a nop, same result. It acts like I am jumping into neverland. Thanks for any help
'=======[Modulator]============================================================                                                
transmitter   and       dira,xdira              'Configure pins for output.
              mov       outa,xouta
              mov       dira,xdira
xmtlp         call      #getstat                'Are we still transmitting?
              and       acc,#STSXMT wz
        if_z  jmp       #standingby             '  No: Go back to standby.
                      
              rdbyte    enq,xenqaddr            'Is enqueue index <> deque index?
              rdbyte    deq,xdeqaddr
              cmp       enq,deq wz
        if_nz jmp       #:dodeq                 '  Yes: There's data to send; go dequeue it.
              call      #send1
              jmp       #xmtlp                 '       Try again.
:dodeq        mov       acc,xbufaddr            'Point to next byte to send.
              add       acc,deq
              rdbyte    data,acc                'Get it.
              add       deq,#1                  'Increment dequeue index.
              and       deq,#BUFMAX             'Point back to beginning if past end.
              wrbyte    deq,xdeqaddr            'Write dequeue pointer back to xdeq.
              or        data,_0x0300              'OR in the stop bit.
              shl       data,#1                 'Shift left to create the start bit.
              mov       bitcnt,#11              'Bit count to send is 10.
:bitloop      shr       data,#1 wc              'Shift next bit into carry.
              call      #sendc
:xnext        djnz      bitcnt,#:bitloop        'Go back for another bit.
              jmp       #xmtlp
'-------[Output bit routines]--------------------------------------------------
sendc   if_nc jmp       #send0                  'Send a bit based on carry flag.
send1         mov       inc,frq2200             'Send a 1-bit.
              call      #sendbit
              jmp       send1_ret
send0         mov       inc,frq1200             'Send a 0-bit.
              call      #sendbit
              
send0_ret
sendnop_ret
send1_ret
sendc_ret     ret
sendbit       mov       phscnt,#16              'One bit is 16 times through.
:loop         add       phase,inc               'Increment phase
              mov       acc,phase               'Copy phase to scratch register.
              call      #sine
                                                  
:putfrqa      shl       acc,outlevel            'Scale it for proper audio level.
              add       acc,_0x8000_0000        'Add "zero" level.
              waitcnt   time,delay              'Wait for it. Waaaiiit for it...
              mov       padc,phsb               'Just to keep receiver ADC in sync.
              mov       frqa,acc                'Okay, write the level to frqa for DUTY output.
              djnz      phscnt,#:loop           'Back for another phase piece.
sendbit_ret   ret

Comments

  • OldFartRadiomanOldFartRadioman Posts: 30
    edited 2013-11-29 19:03
    Found what was needed to fix it. Now would love for someone to explain to me why.
    Replaced the the call #send1 with waitcnt time,delay which should be a delay of 1/16th the bit period.
    Thinking maybe a hub window sync issue?
  • ozpropdevozpropdev Posts: 2,792
    edited 2013-11-29 22:30
    I'm guessing that getstart initializes the timer value?

    Something like
        MOV TIMER,CNT
        ADD TIMER,DELAY
    
  • OldFartRadiomanOldFartRadioman Posts: 30
    edited 2013-11-30 08:15
    Thanks for the reply ozpropdev. Something of a light bulb moment, this statement is required to keep the modulator instep with the bit timing.
Sign In or Register to comment.