Page 286 - Amphibionics : Build Your Own Biologically Inspired Robot
P. 286

Amphibionics 06  3/24/03  9:02 AM  Page 265
                                                                                   PROGRAM 6.12
                        :1003A0002C30712064008518D629D2298610831636
                        :1003B000861083128611831686118312080063004B
                                                                                   rx-remote.hex file listing
                                                                                   (continued)
                        :0203C000DF2933 Chapter 6 / Crocobot: Build Your Own Robotic Crocodile
                        :02400E00F53F7C
                        :00000001FF
                        '------------------------------------------------------------------------------------------------------------------------------
                                                                                   PROGRAM 6.13
                        '  Name      : tx-remote.bas                               tx-remote.bas program
                        '  Compiler  : PicBasic Pro - MicroEngineering Labs        listing
                        '  Notes      : Robot control using the Linx 433LC series
                        '                : transmitter and receiver.
                        '                : Using the PIC 16C71 on-chip analog to digital
                        '                : converters to read the position of
                        '                : the two control stick potentiometers.
                        '------------------------------------------------------------------------------------------------------------------------------
                        ' PIC 16C71 A/D converter registers
                        '
                        ' PORTA = 05 hex = 5 dec
                        ' five I/O lines RA0 RA1 RA2 RA3 RA4
                        '
                        ' TRISA = 85 hex = 133 dec
                        ' data direction register
                        ' ---1 1111 inputs
                        ' ---0 0000 outputs
                        '
                        ' ADCON1 = 88 hex = 136 dec
                        ' configure as A to D converter or digital I/O
                        '    bits    RA0,RA1   RA2      RA3         Vref
                        ' ---- --00  analog    analog   analog      VDD
                        ' ---- --01  analog    analog   ref input   RA3
                        ' ---- --10  analog    digital  digital     VDD
                        ' ---- --11  digital   digital  digital     VDD
                        '
                        ' ADCON0 = 08 hex = 8 dec
                        ' A/D control and status register - 8 bits
                        ' bit7 - ADCS1
                        ' bit6 - ADCS0

                                                                                                 265
   281   282   283   284   285   286   287   288   289   290   291