Can anyone convert this to MMBasic?
| Author | Message | ||||
| lew247 Guru Joined: 23/12/2015 Location: United KingdomPosts: 1709 |
Can anyone convert this to MMBasic? It's the code for a Tetra detector, as in the radio's used by Police, Ambulance and Fire services in Europe The original code was written for a PIC16F818 and uses code like this which I have no clue about ; FI1216 control, ADC and LED bar driver ; V0.0 141130 Initial draft ; V0.1 141201 Done ADC, LED bar ; V0.2 141202 Subroutines, TMR0 ; V0.3 141203 Tetra 4s, MAX HOLD function ; V0.4 141204 Fixed AD, lose controls, enter buttons ; V0.5 141206 I2C ; V0.6 141207 Fixed I2C ; V0.7 141228 BRT Button ; V0.8 141231 THR Button ; V0.9 150118 Cal levels FI1216, f(LO) ; V0.10 150119 THR setting ; V0.11 150119 EEPROM R/W ; V1.0 150119 Release LIST P = 16F818 , F = INHX8M #include < p16f818.inc > __CONFIG _WDT_OFF & _PWRTE_OFF & _INTRC_IO & _MCLR_ON & _BODEN_OFF & _LVP_OFF & _CPD_OFF & _WRT_ENABLE_OFF & _DEBUG_OFF & _CCP1_RB2 & _CP_OFF ; Equates RESET_V EQU 0x00 ; Address of RESET Vector OSC_FREQ EQU D'8000000' ; Internal Oscillator Frequency is 8 MHz ; Registers FLAGS EQU 0x20 ; Various flags THRLVL EQU 0x21 ; Threshold level set via UI MAXH EQU 0x22 ; LEVEL MAX HOLD value to be shown on LED bar TEMPBAR EQU 0x23 ; Pattern on LED bar if it's blanked (BRT) TEMPTHR EQU 0x24 ; Used in threshold set routine BRITE EQU 0x25 ; LED Brightness T4S EQU 0x26 ; Tetra 4s timing I2CDELAY EQU 0x27 ; Used for I2C timing I2CBUF EQU 0x28 ; Used for I2C data I2CCNT EQU 0x29 ; Used for I2C bitbanger DB2 EQU 0x30 ; Stealth byte for prescaler (0x50-0x5F) TEMPW EQU 0x40 ; Context saving for interrupts TEMPSTATUS EQU 0x41 ; in all banks ; Defines #define LEDS PORTB ; 8 LED bar RB0-3 GRN, RB4,5 ORG RB6,7 RED #define RSSI PORTA , I do have a copy of the full code if anyone can convert into Basic or write a simple program to tune the tv tuner, monitor the output and display by led or audible tones depending on the signal strength In the UK the mobiles transmit on 199 25Khz channels in the frequency range 380.0125Mhz - 384.9875Mhz They send a sync signal to the base stations every 4 seconds so the "beacon" can be picked up and displayed by a tone, light or other means There are many ways to do this including using an SDR radio and rtl_power or similar app There are commercial units that do the same thing such as Target Blu Eye and Python Detectors All they do is monitor for the data burst and display that it's been received, there is no decoding or monitoring of the tetra signal at all The version I'm thinking of building uses an old analogue tv tuner as the bandwidth of 1 channel is 8 Mhz which is enough to monitor the whole tetra band at once looking for any signals All the tv tuner has to do is be tuned to around 382.50Mhz which most wideband tuners could do as they covered the VHF and Cable channels as well as the UHF ones One such tuner was the FI1216 which is tuned by it's I2c bus.Remove the TDA9800 demodulator and insert an AD8307 92 dB Logarithmic Amplifier and then send the output into a pic as the person who wrote the code did but I reckon a Pi Pico running MMBasic would do it a lot better and easier IF anyone could program it You can read about the project on the authors page HERE but he gave up on it due to patent trolls threatening him so he removed the code from online This will only work properly if a proper tuned antenna for that frequency is attached as the signals will be pretty weak ![]() You can see a video of a similar type device working on YouTube here |
||||