Sunday, April 29, 2007

Pic Basic Pro

Finally decided that the only way I could reasonably get into using pics was to get Pic Basic Pro. I learning curve is just to steep with the time limitations I have. I need to be using the pics not trying to figure out C or whatever. Basic is easy and I had some experience with Pbasic with the Boe-Bot. There is some stuff to learn with Pic Basic Pro but not unreasonably so.

I have successfully done the blink the led routine. I set up a SOS morse code program and instead of dit dit dit dah dah dah dit dit dit it was doin a dit dit diiiit dah dah daaaah dit dit diiiit. after doing a bunch of things with the program it occured to me that the signal was inverted and it was flashing when it should be dark and vice versa. I swapped the high and low commands to light and extinguish the led and it worked. After thinking a bit I realized that a basic assumption I had was incorrect about the PIC I was using, I thought that if you used a high it would close the switch to +5v, and a low would open the switch to 0v/no connection. That is half right. It appears to put it to +5v on high and 0v/ground on low. What I had done was put the led to the +5v power supply through the resistor to the pin of the PIC. It would flash on the low command because it was going to ground. Amazingly my progam worked correctly when I reversed the led and connected it to ground.

I also got the ICSP to work. Last few dozen tries it just would not work. (ICSP stands for IN-Circuit Serial Programming) I finally decided that it just didn't make sense that it would not work when it should be no different in how it is connected on the programmer. I traced the wired on the programmer and it was identical in hookup as the ICSP would be on the bredboard. That left the differences. I have a 5 leds on the breadboard and so I disconnected all 5 and the ICSP works. It looks like having them hooked up to the +5v strip might have done it, after figuring out I had them hooked up wrong I rehooked up the leds to the ground and the ICSP works. Will see how it works out. So far so good.

Another milestone for me is to be able to do the actually simple task of hooking up a omron solid state relay to the pic output to flash a 40watt lamp. It is quite novel to me to potentially be able to control "real" power switching. The omron is rated to switch at 5-24v dc, to control a load of 30A at 200-480VAC. The lamp I am flashing is on 125 vac which is obviously out of the specification. I assume it is just a matter of not running anything over 15 amps or so (at half the voltage rated)

I origionally got the omron solid state relay to make a spot welder, but now I am thinking something like this might work as a on/off for the sherline cnc motor. I think I will finish the welder first though. One thing at a time.

0 Comments:

Post a Comment

<< Home