ROBODYSSEY SYSTEMS LLC

Product Catalog
Code Page
Policies
Gallery
Whats New
Press Releases
Resources
Links
Contact Us
About Us
Press

Home Product Catalog Shopping Cart Resources Links
Code Page Policies Gallery

The communication cable to the PC is made as specified in the PicBasic Compiler Manual.
1.0K DB9
pin --/\/\/\---- RS-232 RX Pin 2
GND ------------ RS-232 GND Pin 5
This Project saves Data to the Pics EEPROM. First, if the C3 switch is open, the system gathers data in through the A to D on RA0. If the pin is high (jumpered with a resistor to supply) the chip sends the data out to the PC.
See "PicDisplay" for more details.

'****** Writing to EEPROM wit a PIC ***********
'**********************************************
'@ Platform: PicBasic
'@ Version: 1.0
'@ Author: Brian Patton (brianp@robodyssey.com)
' Robodyssey Systems, LLC. - www.robodyssey.com
'@ Last Updated: Feb 20, 2004
'*********Materials*****************************
' 1 Robodyssey PicPac MotherBoard
' 1 Pic16F876 or similar
' 1 Voltage Divider board
' 1 Variable Resistor (pot)or photoresistor
' 1 10k resistor to act as switch on C3
' PicBasic Compiler and a programmer
'***********************************************
' Register Locations
Symbol TRISA = $85 ' Register Location of TRISA Symbol ADCON0 = $1F ' Register location of ADCON0 Symbol ADCON1 = $9F ' Register Location of ADCON1 Symbol ADRESH = $1E ' Register Location of ADRESH Symbol TRISC = $87 ' Register Location of TRISC Symbol PortC = 7 ' Register Location of PortC '***** Variables ******************************* symbol value = b2 'variable for A to D Symbol x = b1 'just a counter '*****Initiation******************************** Init: Dirs = %11111111 ' Set all Port B to output poke TRISC, %11111111 'Set all PortC Input '*****Main Code Block Area********************** '*********************************************** peek PortC,b4 'Get the status of Port C b4 = b4 & %00001000 'Set to 0 all but C3 if b4 = 0 then gather 'IF open then Gather Data 'If closed then Recall Data '********* Get Data Back Out ***************** recall: for x = 1 to 100 'Give you time to turn the pot read x,value 'Read from EEPROM position x into value Serout 0,N2400,("Recalling Data ",#value,10,13) 'display value pause 100 next end '******* Sample an store Data ***************** gather: Serout 0,N2400,("Gathering Data",10,13) 'Display "Gathering Data" on the computer screen Pause 3000 Start: poke TRISA, %11111111 'Set all PortA Input poke ADCON1, %00000010 'xxxx0010 - PortA 0-4 analog inputs, 5-7 digital inputs '0xxxxxxx Sets result to Left justified '1xxxxxxx Sets result to Right justified '******** Move the Servo ********************** AD0chk: for x = 1 to 100 '100 8 bit bytes used poke ADCON0, %11000001 'Set A/D to RC Osc, Channel 0, A/D converter ready 'xx000xxx-Chan 0(RA0), xx001xxx-Chan 1(RA1), 'xx010xxx-Chan 2(RA2), xx011xxx-Chan 3(RA3), 'xx100xxx-Chan 4(RA4), xx101xxx-Chan 5(RA5), 'xx110xxx-Chan 6(RA6), xx111xxx-Chan 7(RA7), b0 = %11000101 'xxxxx1xx - on, xxxxx0xx - off Poke ADCON0,b0 ' Turn on the conversion at Bit 2 AD0fin: Pause 5 Peek ADCON0,b0 If b0 = %11000101 Then AD0fin ' Wait for low on bit-2 of ADCON0, conversion finished
Peek ADRESH,value serout 0,N2400,(#value,10,13) 'display value write x,value 'write to EEPROM position x value sleep 432 'Time between samples..in ths case overnight 'to measure sunlight at dawn Next end

Home Product Catalog Shopping Cart Resources Links
Code Page Policies Gallery

Robodyssey Systems manufactures Robot Kits including Autonomous Mobile Walking Robots, Wheeled Robots, Talking Robots, Expressive Robots, and Social Robots. We also sell Robotics Accessories including Nexcell NiMH AA Rechargeable Batteries, Nexcell NiMH AAA Rechargeable Batteries, Battery Holders, Velcro Straps for Battery Packs, Battery Chargers, Robot Grippers, Hobby Servos, Servos Modified for Continuous Rotation, Tail Wheels for all Rolling Robotic Platforms, Polyurethane Skate Wheels with Servo Adapter Hubs, Sharp IR Sensors and Adjustable Sensor Brackets, Sensor Cables, and Programming Cables. All of our Robot Kits can be purchased as easy to assemble robot kits or as fully assembled stationary or mobile robots. Robodyssey uses 1/8 inch aluminum and acetyl for most all of our mobile robot components and robotics accessories. We provide classroom training for teachers interested in integrating robotics, computer programming and electronics into the classroom.

We hope you enjoy our web site. Feel free to use any robotic resources. Robodyssey is your complete solution for Educational Robotics as well as Hobby Robotics.