Subversion Repositories svnkaklik

Rev

Rev 319 | 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
0204  A2AB              BTFSS gbl_rcsta,1
0206  D002              BRA     label268438550
020C            label268438550

                rcsta.CREN = 0
0208  98AB              BCF gbl_rcsta,4

        rcsta.CREN = 1
020A  88AB              BSF gbl_rcsta,4

        End If
    Do While (pir1.RCIF = 0)
020C  AA9E              BTFSS gbl_pir1,5
020E  D7FE              BRA     label268438550

        Loop
        receive = rcreg
0210  50AE              MOVF gbl_rcreg, W
0212  6E07              MOVWF CompTempVarRet489

        
End Function
0214  0012              RETURN


Sub send(c As Byte)

        Do while (pir1 & (1 << TXIF)) = 0 Loop
0216            label268438561
0216  A89E              BTFSS gbl_pir1,4
0218  D7FE              BRA     label268438561

        txreg = c
021A  5004              MOVF send_00000_arg_c, W
021C  6EAD              MOVWF gbl_txreg

End Sub
021E  0012              RETURN


Sub delay(cas As Byte)

Dim i As Byte
Dim x As Byte
    Do while i <= cas
0220            label268438570
0220  5005              MOVF delay_00000_1_i, W
0222  5C04              SUBWF delay_00000_arg_cas, W
0224  A0D8              BTFSS STATUS,C

     Do While x <= 100
0228  5006              MOVF delay_00000_1_x, W
022A  0864              SUBLW 0x64
022C  E305              BNC     label268438574

      Call receive()
022E  EC02F001          CALL receive_00000

      x=x+1
0232  2806              INCF delay_00000_1_x, W
0234  6E06              MOVWF delay_00000_1_x

     loop
0236  D7F8              BRA     label4026532417
0238            label268438574

    i=i+1
0238  2805              INCF delay_00000_1_i, W
023A  6E05              MOVWF delay_00000_1_i

        loop
023C  D7F1              BRA     label268438570

        
End Sub
0226  0012              RETURN
0228            label4026532417


Sub main()

        Dim motors As Byte
        Dim sensors As Byte
        Dim buttons As Byte
        Dim i As Long

        'NASTAVENI IO
        lata=0xFF
023E  6889              SETF gbl_lata

        latb=0
0240  6A8A              CLRF gbl_latb

        latc=0xFF
0242  688B              SETF gbl_latc

        trisa=0xF0
0244  0EF0              MOVLW 0xF0
0246  6E92              MOVWF gbl_trisa

        trisb=0x3F
0248  0E3F              MOVLW 0x3F
024A  6E93              MOVWF gbl_trisb

        trisc=0x9F
024C  0E9F              MOVLW 0x9F
024E  6E94              MOVWF gbl_trisc


        'VYPNOUT ADC
        adcon1=0xC6
0250  0EC6              MOVLW 0xC6
0252  6EC1              MOVWF gbl_adcon1

        adcon0=0xC0
0254  0EC0              MOVLW 0xC0
0256  6EC2              MOVWF gbl_adcon0


        'UART 9600bps
        spbrg=64
0258  0E40              MOVLW 0x40
025A  6EAF              MOVWF gbl_spbrg

        txsta = txsta & ~(1 << BRGH)
025C  0EFB              MOVLW 0xFB
025E  14AC              ANDWF gbl_txsta, W
0260  6EAC              MOVWF gbl_txsta

        txsta = txsta | (1 << TXEN)
0262  0E20              MOVLW 0x20
0264  10AC              IORWF gbl_txsta, W
0266  6EAC              MOVWF gbl_txsta

        rcsta = rcsta | (1 << CREN)
0268  0E10              MOVLW 0x10
026A  10AB              IORWF gbl_rcsta, W
026C  6EAB              MOVWF gbl_rcsta

        rcsta = rcsta | (1 << SPEN)
026E  0E80              MOVLW 0x80
0270  10AB              IORWF gbl_rcsta, W
0272  6EAB              MOVWF gbl_rcsta

                                
        motors = 0x00
0274  6A01              CLRF main_1_motors

        
        lata = 0x0E 
0276  0E0E              MOVLW 0x0E
0278  6E89              MOVWF gbl_lata

    Call delay(200)
027A  0EC8              MOVLW 0xC8
027C  6E04              MOVWF delay_00000_arg_cas
027E  EC10F001          CALL delay_00000

        lata = 0x0D
0282  0E0D              MOVLW 0x0D
0284  6E89              MOVWF gbl_lata

    Call delay(200)
0286  0EC8              MOVLW 0xC8
0288  6E04              MOVWF delay_00000_arg_cas
028A  EC10F001          CALL delay_00000

        lata = 0x0B
028E  0E0B              MOVLW 0x0B
0290  6E89              MOVWF gbl_lata

    Call delay(200)
0292  0EC8              MOVLW 0xC8
0294  6E04              MOVWF delay_00000_arg_cas
0296  EC10F001          CALL delay_00000

        lata = 0x07
029A  0E07              MOVLW 0x07
029C  6E89              MOVWF gbl_lata

    Call delay(200)
029E  0EC8              MOVLW 0xC8
02A0  6E04              MOVWF delay_00000_arg_cas
02A2  EC10F001          CALL delay_00000


        motors = 0x77
02A6  0E77              MOVLW 0x77
02A8  6E01              MOVWF main_1_motors


    Call delay(100)
02AA  0E64              MOVLW 0x64
02AC  6E04              MOVWF delay_00000_arg_cas
02AE  EC10F001          CALL delay_00000


                
Do while 1
02B2            label268438640


  sensors =0xFF 
02B2  6802              SETF main_1_sensors

  sensors = Call receive()      'prijmi stav cidel senzoru
02B4  EC02F001          CALL receive_00000
02B8  5007              MOVF CompTempVarRet489, W
02BA  6E02              MOVWF main_1_sensors

                
  If (!((sensors.0) and (sensors.1))) Then
02BC  6A03              CLRF CompTempVar491
02BE  A202              BTFSS main_1_sensors,1
02C0  D003              BRA     label268438645
02C2  A002              BTFSS main_1_sensors,0
02C4  D001              BRA     label268438645
02C6  2A03              INCF CompTempVar491, F
02C8            label268438645
02C8  5203              MOVF CompTempVar491, F
02CA  E102              BNZ     label268438646
02D0            label268438646

    motors = 0x77
02CC  0E77              MOVLW 0x77
02CE  6E01              MOVWF main_1_motors

  End If
                        
  If (!(sensors.2)) Then
02D0  B402              BTFSC main_1_sensors,2
02D2  D002              BRA     label268438649
02D8            label268438649

    motors = 0xF7
02D4  0EF7              MOVLW 0xF7
02D6  6E01              MOVWF main_1_motors

  End If
                
  If (!(sensors.3)) Then
02D8  B602              BTFSC main_1_sensors,3
02DA  D002              BRA     label268438652
02E0            label268438652

    motors = 0x7F
02DC  0E7F              MOVLW 0x7F
02DE  6E01              MOVWF main_1_motors

  End If 
                                
  lata = sensors
02E0  5002              MOVF main_1_sensors, W
02E2  6E89              MOVWF gbl_lata

  call send(motors)
02E4  5001              MOVF main_1_motors, W
02E6  6E04              MOVWF send_00000_arg_c
02E8  EC0BF001          CALL send_00000

                
Loop
02EC  D7E2              BRA     label268438640

        
End Sub


////////////////////////////////////////
// Code with no source :-)
////////////////////////////////////////
0200  EF77F001          GOTO    _startup







02EE            _startup
02EE  EF1FF001          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