![]()
Flash Dash Entry - M292
AS7010 – STMeter
Abstract
The application is designed to provide a handheld installation tool to assist in the set-up and configuration of wireless DSL subscriber terminals operating in a point to multi-point configuration. The subscriber terminal (ST) contains both an outdoor antenna unit (radio interface) and an indoor unit with the main processor, voice (POTS) circuits, Ethernet interface and maintenance port. To set-up a unit it must be configured with a unique identifier and various radio parameters such as uplink and downlink frequency and then the outdoor unit must be aligned so that it points towards the central transmitter. Initially the subscriber terminals (ST) were set-up using a windows based installation program communicating with the main ST processor via the RS232 maintenance port on the ST. The outdoor antenna unit was then aligned using either a voltmeter to measure the received signal strength which is available via a pin on the unit or by reading the received signal strength from the installation program and yelling the reading to the person aligning the outdoor unit – a two man operation.
However this approach is not idea for every installation. Some customers are reluctant to provide a laptop to run the installation program, this is especially true in developing countries where the cost of a laptop is significantly more than the wages earned by the installation crew, and the need in some situations for a two man installation crew was less than ideal.
STMeter attempts to address these problems by providing a cheap easy to use installation tool. Whilst it does not provide all of the functionality of the windows based installation program it does allow the majority of installations to be carried out without the need for a laptop computer. Cost and ease of use were the main design requirements, the units had to be operable, using one hand, whilst standing on a ladder (the majority of the antenna units are roof or eaves mounted) and had to be sufficiently cheap that in developing countries customers could afford to provide each of the installation crews with a unit.
The PIC16F877 was chosen as the processor as it provided sufficient I/O pins to drive an LCD, interface to the keypad, it contained a UART and had an ADC. The power is supplied by either the maintenance port of the Subscriber Terminal via a step down regulator or from two AA cells via a step up regulator. The unit enters a powered down sleep mode when not in use and is reactivated by pressing any of the buttons on the keypad.
When the STMeter is attached to the ST maintenance port the UART is used to pass information to the main ST processor using a SLIP like protocol (see RFC 1055 available on the internet). The ADC operates in place of a voltmeter and allows the outdoor antenna unit to be aligned using the received signal strength. The received signal strength is presented on the STMeter display as a bargraph which is much easier to use than the constantly flickering display of a Digital Voltmeter. Additionally the signal from the received signal strength pin is used to periodically pass additional information to STMeter by encoding the information using a 2B1Q coding scheme.
The software is written in MPASM assembler and the development work was carried out using the IDC background debugger. An object orientated approach was used to divide the code into manageable modules which keeps the functionality of each of the module within the module. The software is all event driven using both interrupts and regular polling of peripherals to generate the events. The keypad is used to navigate through an extensive menu as a considerable amount of information needs to be displayed on the 2x16 LCD. The code snippet provided is of the Task Manager control loop which shows the event handler, this function runs continuously in an endless loop.
;***** Task Manager - Main Control Loop *******************************
TaskMan clrwdt ; Kick Watchdog
movlw DEBUG_MAIN4 ; Stack Depth = 5
movwf DEBUG
btfss INTCON, GIE ; Check that Global Interupt is enabled
goto MainCode ; No - reboot unit
btfss INTCON, PEIE ; Check that Peripheral Interupt is enabled
goto MainCode ; No - reboot unit
PAGESEL SWpoll
call SWpoll ; Poll switches to detect any changes
BANK0
EventMenuRpt btfss EVENT_2, EVENT_REPEAT ; Check if menu item needs to repeat
goto EventChk1
bcf EVENT_2, EVENT_REPEAT ; Clear menu repeat flag
PAGESEL MENUcall
movlw REPEAT
call MENUcall
BANK0
EventChk1 btfss EVENT_1, EVENT_SW_LEFT ; Check for Left Switch pressed event
goto EventChk2
bcf EVENT_2, EVENT_REPEAT ; Clear menu repeat flag
bsf EVENT_1, EVENT_PWR_RFSH ; Set Power Down Timer Refresh flag
PAGESEL MENUcall
movlw SW_LEFT
call MENUcall
BANK0
bcf EVENT_1, EVENT_SW_LEFT ; Clear event flag
EventChk2 btfss EVENT_1, EVENT_SW_CIRCLE ; Check for Circle Switch pressed event
goto EventChk3
bcf EVENT_2, EVENT_REPEAT ; Clear menu repeat flag
bsf EVENT_1, EVENT_PWR_RFSH ; Set Power Down Timer Refresh flag
PAGESEL MENUcall
movlw SW_CIRCLE
call MENUcall
BANK0
bcf EVENT_1, EVENT_SW_CIRCLE ; Clear event flag
EventChk3 btfss EVENT_1, EVENT_SW_RIGHT ; Check for Right Switch pressed event
goto EventChk4
bcf EVENT_2, EVENT_REPEAT ; Clear menu repeat flag
bsf EVENT_1, EVENT_PWR_RFSH ; Set Power Down Timer Refresh flag
PAGESEL MENUcall
movlw SW_RIGHT
call MENUcall
BANK0
bcf EVENT_1, EVENT_SW_RIGHT ; Clear event flag
EventChk4 btfss EVENT_1, EVENT_SW_BACK ; Check for Circle Switch pressed for > 1 sec event
goto EventChk5
bcf EVENT_2, EVENT_REPEAT ; Clear menu repeat flag
bsf EVENT_1, EVENT_PWR_RFSH ; Set Power Down Timer Refresh flag
PAGESEL MENUcall
movlw SW_BACK
call MENUcall
BANK0
bcf EVENT_1, EVENT_SW_BACK ; Clear event flag
EventChk5 btfss EVENT_1, EVENT_LIGHT ; Check for Back Light On event
goto EventChk6
PAGESEL LITEon
call LITEon
BANK0
bcf EVENT_1, EVENT_LIGHT ; Clear Back Light ON event
EventChk6 btfss EVENT_2, EVENT_RX_PKT ; Check for valid Rx Data Packet
goto EventChk7
bsf EVENT_1, EVENT_PWR_RFSH ; Set Power Down Timer Refresh flag
PAGESEL MENUcall
movlw REPEAT
call MENUcall
BANK0
bcf EVENT_2, EVENT_RX_PKT ; Clear Rx Data Packet flag
EventChk7 btfss EVENT_1, EVENT_PWR_RFSH ; Check for Power Down Timer Refresh
goto EventChk8
PAGESEL TIMERPWR
call TIMERPWR
BANK0
bcf EVENT_1, EVENT_PWR_RFSH ; Clear Power Down Timer Refresh flag
EventChk8 nop
EventChkBuzz BANK0
bcf BUZZREG, BUZZFLG
btfsc EVENT_1, EVENT_BUZZER ; Check for Buzzer ON event
bsf BUZZREG, BUZZFLG ; Set Buzzer flag
btfsc EVENT_1, EVENT_BUZZ_ERR ; Check for ERROR (Buzzer ON) event
bsf BUZZREG, BUZZFLG ; Set Buzzer flag
btfss BUZZREG, BUZZFLG ; Check Buzzer flag
goto EventBuzzOFF
EventBuzzON
PAGESEL BUZZon
call BUZZon ; Turn Buzzer On
goto EventChkEnd
EventBuzzOFF
PAGESEL BUZZoff
call BUZZoff ; Turn Buzzer Off
EventChkEnd
PAGESEL LCDrefresh
call LCDrefresh ; Refresh the LCD display
PAGESEL UARTsend
call UARTsend ; Transmit any data from the Tx Buffer
PAGESEL TaskMan
goto TaskMan ; Start TaskMan loop again
Stop goto Stop ; Should never get here
;***** Control Loop End - End Of Main Thread **************************

