2007 28 Nov

Still haven’t completed I2C Master/Slave communication test, but will move on!

I’m now defining how PC will communicate with PIC Master, how will the Robot computer send commands and receive data to the Master PIC. The Master PIC will them make the interface between PC and Sensors/Modules trough an I2C bus.

I have decided to send commands in the following format (PC to PIC Master - frame data):

<id, type, cmd, data0, data1, data2, data3, data4, data5, data6, data7, data8, data9>

id = device ID number (Slave or Master)
type = defines type of sensor/module {10=DCmotor, 11-Servo, …}
cmd = command
data0 to data1 = additional data

The Master PIC will receive the command from Robot computer (Via RS232) and parse it into a special object that will be sent to sensors/modules trough the I2C channel. After sending the commands in the I2C channel, the Master PIC will wait for the acknowledge of that command from the sensor/module. PIC Master will then read data from sensors/modules and save data into special object. When receiving the last byte from sensors/modules, PIC Master will them compose frame data and send it back to Robot computer. Continue reading »


 
2007 27 Nov

Unfortunately couldn’t test I2C Master/Slave communication between 2 Pic 16F268 due to lack of hardware capabilities! The 16F628 doesn’t have SSP module and so can not support I2C protocol by hardware. I  have tested I2C Master by software when communicating between Pic Master and Dallas DS1721 ‘2-Wire Digital Thermometer and Thermostat’ Slave. It worked fine, but I really need the full capability of I2C Slave by hardware (Interrupt Routine) and at this moment have only emulated the Master side! Also would like to leave my code small and clean! 

I have now found alternative Pic with SPP (I2C by Hardware) support - PIC 16F690 I/P . Still searching for this device on local electronic stores, but no luck yet! Better to order from Internet :) .

While waiting for the new Pics I will try to make some more advanced tests.


 
2007 20 Nov

This test will be part of one of the main module that I will need to communicate between PC and all sensors/modules. I want for the PC from the robot to communicate with one Master PIC by RS232, exchanging commands and information to/from sensors/modules. Than the Master PIC will make the interface to all sensor/modules by I2C Bus.

Still have a lot of work to do on the H-Bridge module, and the I2C Bus, but decided to test RS232! It was fun to play with and my test worked well!

I’ve just assembled on a test board this simple circuit:

Pic16F628A RS232 Test

Continue reading »


 
2007 19 Nov

Now that my lab tools are all set I need to test my Pic16F628A to get a PWM signal. This signal will later be applied to the H-Bridge circuit that will control DC motors power. For the test I’ve used this circuit:

Pic16F628A PWM Test Continue reading »


 
2007 17 Nov

Just made some tests to see how CCSInfo Compiler works! I’m really impressed! Very simple and easy!

For this test I’ve used Microchip PIC 16F628A working with an external 4MHz resonator and 1 led connected to the RB0 (pin6) - also requires one 1KOhm pull-up resistor to the led and the MCLR resistor to VCC.

Led Blink Test

  1. #include <16F628A.h>
  2. #use delay(clock=4000000)
  3. #fuses NOWDT, HS, PUT, NOPROTECT, BROWNOUT, MCLR, NOLVP, NOCPD
  4. //————————————————————————————————————————————————————————————
  5. void main(void)
  6. {
  7.   delay_ms(100); // power up delay
  8.  
  9.   setup_comparator(NC_NC_NC_NC);
  10.   setup_vref(FALSE);
  11.   set_tris_b(0b11111110);
  12.  
  13.   while( TRUE )
  14.   {
  15.     output_low(PIN_B0);
  16.     delay_ms(500);
  17.     output_high(PIN_B0);
  18.     delay_ms(500);
  19.   }
  20. }
  21. //————————————————————————————————————————————————————————————

Continue reading »


 
2007 16 Nov

I’ve previously work with Microchip Pic using MPLab and Assembler language! It’s very powerful but also time consuming! Now I’m using one tool to develop my Pic code from C language. I’m very impressed, It’s very easy to develop and there is a big community in the web that creates C libraries for tools like this!

This is a list of the software that I’m using now to develop on Microchip Pics:

Microchip MPLab8 IDE: (MPLAB)

Nice tool to code Assembler for pics but I’m using it to debug C code from CCSInfo PICC. There is one plug-in to integrate both tools! Excellent!

MPlab8 Continue reading »


 
2007 01 Nov

I’ve just completed the 2nd H-Bridge circuit to command the DC motor. Since my time is short I decided to make the circuit on a test PCB board. I’m also a little rusty on the PCB software (Protel or Eagle - no more Orcad for me, I’ve had my share!). I’ve done better circuits, but this works and I’m good with that!

botdream interface Continue reading »