DearAll
With a bit of time on my hands I want to built a waterproof radio because a lot of time is spent outdoors.
I have a TEA 5767 module , which with the help of another member's code from this forum I can receive stations.
However the station frequency is entered into the module via the programming cable and are set as constants.
Can anyone help me work out how to enter variables (b0 = 93 b1= 3) which will be stored in memory into the the formula. I hope I'm not stepping into 32bit maths territory!
thanks
Stay Safe
Tim
#picaxe 20m2
#no_data
#terminal 4800
hi2csetup i2cmaster, %11000000, i2cfast, i2cbyte ;tea5767
pause 3000
;(4*(93.3*1000000+225000))/32768
Symbol freq = 93300000 ; 93.3 MHz
Symbol freqValue = freq + 225000 ;for HSI
Symbol freqVal = freqValue / 8192
Symbol freqVal.msb = freqVal / 256
Symbol freqVal.lsb = freqVal & 255
pause 100
rem sertxd ("Start",13,10)
main:
rem sertxd (freqSmall,13,10) ; was "#frqsmall"
hi2cout 0,(freqVal.msb,freqVal.lsb,$10,$10,$40)
rem gosub serOutTunerData
goto main
serOutTunerData:
pause 1000
hi2cin 0,(b0,b1,b2,b3,b4)
sertxd ("Byte1: ",bit7,bit6,bit5,bit4,bit3,bit2,bit1,bit0,13,10)
sertxd ("Byte2: ",bit15,bit14,bit13,bit12,bit11,bit10,bit9,bit8,13,10)
sertxd ("Byte3: ",bit23,bit22,bit21,bit20,bit19,bit18,bit17,bit16,13,10)
sertxd ("Byte4: ",bit31,bit30,bit29,bit28,bit27,bit26,bit25,bit24,13,10,13,10)
pause 9000
return
With a bit of time on my hands I want to built a waterproof radio because a lot of time is spent outdoors.
I have a TEA 5767 module , which with the help of another member's code from this forum I can receive stations.
However the station frequency is entered into the module via the programming cable and are set as constants.
Can anyone help me work out how to enter variables (b0 = 93 b1= 3) which will be stored in memory into the the formula. I hope I'm not stepping into 32bit maths territory!
thanks
Stay Safe
Tim
#picaxe 20m2
#no_data
#terminal 4800
hi2csetup i2cmaster, %11000000, i2cfast, i2cbyte ;tea5767
pause 3000
;(4*(93.3*1000000+225000))/32768
Symbol freq = 93300000 ; 93.3 MHz
Symbol freqValue = freq + 225000 ;for HSI
Symbol freqVal = freqValue / 8192
Symbol freqVal.msb = freqVal / 256
Symbol freqVal.lsb = freqVal & 255
pause 100
rem sertxd ("Start",13,10)
main:
rem sertxd (freqSmall,13,10) ; was "#frqsmall"
hi2cout 0,(freqVal.msb,freqVal.lsb,$10,$10,$40)
rem gosub serOutTunerData
goto main
serOutTunerData:
pause 1000
hi2cin 0,(b0,b1,b2,b3,b4)
sertxd ("Byte1: ",bit7,bit6,bit5,bit4,bit3,bit2,bit1,bit0,13,10)
sertxd ("Byte2: ",bit15,bit14,bit13,bit12,bit11,bit10,bit9,bit8,13,10)
sertxd ("Byte3: ",bit23,bit22,bit21,bit20,bit19,bit18,bit17,bit16,13,10)
sertxd ("Byte4: ",bit31,bit30,bit29,bit28,bit27,bit26,bit25,bit24,13,10,13,10)
pause 9000
return