Rev 321 | Go to most recent revision | Blame | Last modification | View Log | Download
;/////////////////////////////////////////////////////////////////////////////////
;// Code Generator: BoostBasic Compiler - http://www.sourceboost.com
;// Version : 6.70
;// License Type : Pro License
;// Limitations : PIC18 max code size:Unlimited, max RAM banks:Unlimited
;/////////////////////////////////////////////////////////////////////////////////
'robot
'#pragma DATA _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H
#pragma DATA _CONFIG1H, _OSCS_OFF_1H & _HSPLL_OSC_1H
#pragma DATA _CONFIG2L, _BOR_ON_2L & _BORV_42_2L & _PWRT_ON_2L
#pragma DATA _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H
#pragma DATA _CONFIG3H, _CCP2MX_OFF_3H
#pragma DATA _CONFIG4L, _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_OFF_4L
#pragma DATA _CONFIG5L, _CP0_ON_5L & _CP1_ON_5L & _CP2_ON_5L & _CP3_ON_5L
#pragma DATA _CONFIG5H, _CPB_ON_5H & _CPD_ON_5H
#pragma DATA _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L
#pragma DATA _CONFIG6H, _WRTC_ON_6H & _WRTB_ON_6H & _WRTD_OFF_6H
#pragma DATA _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L
#pragma DATA _CONFIG7H, _EBTRB_ON_7H
#pragma CLOCK_FREQ 40000000
Function receive() As Byte
If ( (rcsta.OERR = 1) ) Then
020E A2AB BTFSS gbl_rcsta,1
0210 D002 BRA label268438551
0216 label268438551
rcsta.CREN = 0
0212 98AB BCF gbl_rcsta,4
rcsta.CREN = 1
0214 88AB BSF gbl_rcsta,4
End If
Do While (pir1.RCIF = 0)
0216 AA9E BTFSS gbl_pir1,5
0218 D7FE BRA label268438551
Loop
receive = rcreg
021A 50AE MOVF gbl_rcreg, W
021C 6E07 MOVWF CompTempVarRet489
End Function
021E 0012 RETURN
Sub send(c As Byte)
Do while (pir1 & (1 << TXIF)) = 0 Loop
0204 label268438562
0204 A89E BTFSS gbl_pir1,4
0206 D7FE BRA label268438562
txreg = c
0208 5007 MOVF send_00000_arg_c, W
020A 6EAD MOVWF gbl_txreg
End Sub
020C 0012 RETURN
Sub main()
Dim motors As Byte
Dim sensors As Byte
Dim buttons As Byte
Dim leds As Byte
Dim count As word
Dim i As Long
'NASTAVENI IO
lata=0xFF
0220 6889 SETF gbl_lata
latb=0
0222 6A8A CLRF gbl_latb
latc=0xFF
0224 688B SETF gbl_latc
trisa=0xF0
0226 0EF0 MOVLW 0xF0
0228 6E92 MOVWF gbl_trisa
trisb=0x3F
022A 0E3F MOVLW 0x3F
022C 6E93 MOVWF gbl_trisb
trisc=0x9F
022E 0E9F MOVLW 0x9F
0230 6E94 MOVWF gbl_trisc
'VYPNOUT ADC
adcon1=0xC6
0232 0EC6 MOVLW 0xC6
0234 6EC1 MOVWF gbl_adcon1
adcon0=0xC0
0236 0EC0 MOVLW 0xC0
0238 6EC2 MOVWF gbl_adcon0
'UART 9600bps
spbrg=64
023A 0E40 MOVLW 0x40
023C 6EAF MOVWF gbl_spbrg
txsta = txsta & ~(1 << BRGH)
023E 0EFB MOVLW 0xFB
0240 14AC ANDWF gbl_txsta, W
0242 6EAC MOVWF gbl_txsta
txsta = txsta | (1 << TXEN)
0244 0E20 MOVLW 0x20
0246 10AC IORWF gbl_txsta, W
0248 6EAC MOVWF gbl_txsta
rcsta = rcsta | (1 << CREN)
024A 0E10 MOVLW 0x10
024C 10AB IORWF gbl_rcsta, W
024E 6EAB MOVWF gbl_rcsta
rcsta = rcsta | (1 << SPEN)
0250 0E80 MOVLW 0x80
0252 10AB IORWF gbl_rcsta, W
0254 6EAB MOVWF gbl_rcsta
motors = 0x00
0256 6A01 CLRF main_1_motors
do while (portb.0 = 1)
0258 label268438598
0258 B081 BTFSC gbl_portb,0
025A D7FE BRA label268438598
loop
leds = 0xF0
025C 0EF0 MOVLW 0xF0
025E 6E03 MOVWF main_1_leds
count = 400000
0260 0E80 MOVLW 0x80
0262 6E04 MOVWF main_1_count
0264 0E1A MOVLW 0x1A
0266 6E05 MOVWF main_1_count+D'1'
do while (count > 0)
0268 label268438603
0268 5004 MOVF main_1_count, W
026A 0800 SUBLW 0x00
026C B0D8 BTFSC STATUS,C
026E 5005 MOVF main_1_count+D'1', W
0270 E013 BZ label268438605
count = count -1
0272 0E01 MOVLW 0x01
0274 5C04 SUBWF main_1_count, W
0276 6E07 MOVWF CompTempVar492
0278 A0D8 BTFSS STATUS,C
027A 0605 DECF main_1_count+D'1', F
027C 5007 MOVF CompTempVar492, W
027E 6E04 MOVWF main_1_count
if count < 300000 then
leds = leds | 1
0280 0E01 MOVLW 0x01
0282 1003 IORWF main_1_leds, W
0284 6E03 MOVWF main_1_leds
end if
if count < 200000 then
leds = leds | 2
0286 0E02 MOVLW 0x02
0288 1003 IORWF main_1_leds, W
028A 6E03 MOVWF main_1_leds
end if
if count < 100000 then
leds = leds | 4
028C 0E04 MOVLW 0x04
028E 1003 IORWF main_1_leds, W
0290 6E03 MOVWF main_1_leds
end if
lata = leds
0292 5003 MOVF main_1_leds, W
0294 6E89 MOVWF gbl_lata
loop
0296 D7E8 BRA label268438603
0298 label268438605
leds = 0xFF
0298 6803 SETF main_1_leds
lata = 0xFF
029A 6889 SETF gbl_lata
Do while 1
029C label268438623
sensors =0xFF
029C 6802 SETF main_1_sensors
sensors = Call receive() 'prijmi stav cidel senzoru
029E EC07F001 CALL receive_00000
02A2 5007 MOVF CompTempVarRet489, W
02A4 6E02 MOVWF main_1_sensors
If (!((sensors.0) and (sensors.1))) Then
02A6 6A06 CLRF CompTempVar491
02A8 A202 BTFSS main_1_sensors,1
02AA D003 BRA label268438628
02AC A002 BTFSS main_1_sensors,0
02AE D001 BRA label268438628
02B0 2A06 INCF CompTempVar491, F
02B2 label268438628
02B2 5206 MOVF CompTempVar491, F
02B4 E102 BNZ label268438629
02BA label268438629
motors = 0x77
02B6 0E77 MOVLW 0x77
02B8 6E01 MOVWF main_1_motors
End If
If (!(sensors.2)) Then
02BA B402 BTFSC main_1_sensors,2
02BC D002 BRA label268438632
02C2 label268438632
motors = 0xF7
02BE 0EF7 MOVLW 0xF7
02C0 6E01 MOVWF main_1_motors
End If
If (!(sensors.3)) Then
02C2 B602 BTFSC main_1_sensors,3
02C4 D002 BRA label268438635
02CA label268438635
motors = 0x7F
02C6 0E7F MOVLW 0x7F
02C8 6E01 MOVWF main_1_motors
End If
lata = sensors
02CA 5002 MOVF main_1_sensors, W
02CC 6E89 MOVWF gbl_lata
call send(motors)
02CE 5001 MOVF main_1_motors, W
02D0 6E07 MOVWF send_00000_arg_c
02D2 EC02F001 CALL send_00000
Loop
02D6 D7E2 BRA label268438623
End Sub
////////////////////////////////////////
// Code with no source :-)
////////////////////////////////////////
0200 EF6CF001 GOTO _startup
02D8 _startup
02D8 EF10F001 GOTO main
300000 FEFF DW 0xFEFF
300002 FEF6 DW 0xFEF6
300004 FEFF DW 0xFEFF
300006 FFFB DW 0xFFFB
300008 3FF0 DW 0x3FF0
30000A 9FFF DW 0x9FFF
30000C BFFF DW 0xBFFF