Rev 323 | 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 6E09 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 5009 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 Long
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'
0268 0E06 MOVLW 0x06
026A 6E06 MOVWF main_1_count+D'2'
026C 6A07 CLRF main_1_count+D'3'
do while (count > 0)
026E label268438603
026E 5007 MOVF main_1_count+D'3', W
0270 0800 SUBLW 0x00
0272 E108 BNZ label268438604
0274 5006 MOVF main_1_count+D'2', W
0276 0800 SUBLW 0x00
0278 E105 BNZ label268438604
027A 5005 MOVF main_1_count+D'1', W
027C 0800 SUBLW 0x00
027E E102 BNZ label268438604
0280 5004 MOVF main_1_count, W
0282 0800 SUBLW 0x00
0284 label268438604
0284 BE07 BTFSC main_1_count+D'3',7
0286 80D8 BSF STATUS,C
0288 E24A BC label268438608
count = count -1
028A 0E01 MOVLW 0x01
028C 5C04 SUBWF main_1_count, W
028E 6E09 MOVWF CompTempVar492
0290 0E00 MOVLW 0x00
0292 6E0A MOVWF CompTempVar496
0294 A0D8 BTFSS STATUS,C
0296 3C0A INCFSZ CompTempVar496, W
0298 5E05 SUBWF main_1_count+D'1', F
029A 0E00 MOVLW 0x00
029C 6E0A MOVWF CompTempVar496
029E A0D8 BTFSS STATUS,C
02A0 3C0A INCFSZ CompTempVar496, W
02A2 5E06 SUBWF main_1_count+D'2', F
02A4 0E00 MOVLW 0x00
02A6 6E0A MOVWF CompTempVar496
02A8 A0D8 BTFSS STATUS,C
02AA 3C0A INCFSZ CompTempVar496, W
02AC 5E07 SUBWF main_1_count+D'3', F
02AE 5009 MOVF CompTempVar492, W
02B0 6E04 MOVWF main_1_count
if count < 300000 then
02B2 0E00 MOVLW 0x00
02B4 5C07 SUBWF main_1_count+D'3', W
02B6 E108 BNZ label268438620
02B8 0E04 MOVLW 0x04
02BA 5C06 SUBWF main_1_count+D'2', W
02BC E105 BNZ label268438620
02BE 0E93 MOVLW 0x93
02C0 5C05 SUBWF main_1_count+D'1', W
02C2 E102 BNZ label268438620
02C4 0EE0 MOVLW 0xE0
02C6 5C04 SUBWF main_1_count, W
02C8 label268438620
02C8 E302 BNC label4026532500
02CA AE07 BTFSS main_1_count+D'3',7
02CC D003 BRA label268438624
02CE label4026532500
02D4 label268438624
leds = leds | 1
02CE 0E01 MOVLW 0x01
02D0 1003 IORWF main_1_leds, W
02D2 6E03 MOVWF main_1_leds
end if
if count < 200000 then
02D4 0E00 MOVLW 0x00
02D6 5C07 SUBWF main_1_count+D'3', W
02D8 E108 BNZ label268438626
02DA 0E03 MOVLW 0x03
02DC 5C06 SUBWF main_1_count+D'2', W
02DE E105 BNZ label268438626
02E0 0E0D MOVLW 0x0D
02E2 5C05 SUBWF main_1_count+D'1', W
02E4 E102 BNZ label268438626
02E6 0E40 MOVLW 0x40
02E8 5C04 SUBWF main_1_count, W
02EA label268438626
02EA E302 BNC label4026532501
02EC AE07 BTFSS main_1_count+D'3',7
02EE D003 BRA label268438630
02F0 label4026532501
02F6 label268438630
leds = leds | 2
02F0 0E02 MOVLW 0x02
02F2 1003 IORWF main_1_leds, W
02F4 6E03 MOVWF main_1_leds
end if
if count < 100000 then
02F6 0E00 MOVLW 0x00
02F8 5C07 SUBWF main_1_count+D'3', W
02FA E108 BNZ label268438632
02FC 0E01 MOVLW 0x01
02FE 5C06 SUBWF main_1_count+D'2', W
0300 E105 BNZ label268438632
0302 0E86 MOVLW 0x86
0304 5C05 SUBWF main_1_count+D'1', W
0306 E102 BNZ label268438632
0308 0EA0 MOVLW 0xA0
030A 5C04 SUBWF main_1_count, W
030C label268438632
030C E302 BNC label4026532502
030E AE07 BTFSS main_1_count+D'3',7
0310 D003 BRA label268438636
0312 label4026532502
0318 label268438636
leds = leds | 4
0312 0E04 MOVLW 0x04
0314 1003 IORWF main_1_leds, W
0316 6E03 MOVWF main_1_leds
end if
lata = leds
0318 5003 MOVF main_1_leds, W
031A 6E89 MOVWF gbl_lata
loop
031C D7A8 BRA label268438603
031E label268438608
lata = 0xFF
031E 6889 SETF gbl_lata
Do while 1
0320 label268438640
sensors =0xFF
0320 6802 SETF main_1_sensors
sensors = Call receive() 'prijmi stav cidel senzoru
0322 EC07F001 CALL receive_00000
0326 5009 MOVF CompTempVarRet489, W
0328 6E02 MOVWF main_1_sensors
If (!((sensors.0) and (sensors.1))) Then
032A 6A08 CLRF CompTempVar491
032C A202 BTFSS main_1_sensors,1
032E D003 BRA label268438645
0330 A002 BTFSS main_1_sensors,0
0332 D001 BRA label268438645
0334 2A08 INCF CompTempVar491, F
0336 label268438645
0336 5208 MOVF CompTempVar491, F
0338 E102 BNZ label268438646
033E label268438646
motors = 0x77
033A 0E77 MOVLW 0x77
033C 6E01 MOVWF main_1_motors
End If
If (!(sensors.2)) Then
033E B402 BTFSC main_1_sensors,2
0340 D002 BRA label268438649
0346 label268438649
motors = 0xF7
0342 0EF7 MOVLW 0xF7
0344 6E01 MOVWF main_1_motors
End If
If (!(sensors.3)) Then
0346 B602 BTFSC main_1_sensors,3
0348 D002 BRA label268438652
034E label268438652
motors = 0x7F
034A 0E7F MOVLW 0x7F
034C 6E01 MOVWF main_1_motors
End If
lata = sensors
034E 5002 MOVF main_1_sensors, W
0350 6E89 MOVWF gbl_lata
call send(motors)
0352 5001 MOVF main_1_motors, W
0354 6E09 MOVWF send_00000_arg_c
0356 EC02F001 CALL send_00000
Loop
035A D7E2 BRA label268438640
End Sub
////////////////////////////////////////
// Code with no source :-)
////////////////////////////////////////
0200 EFAEF001 GOTO _startup
035C _startup
035C 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