JWColby
jwcolby at colbyconsulting.com
Mon Sep 25 07:51:44 CDT 2006
Lembit, I thought of you when I posted this, knowing that you had been working on controlling your new home. If you are just getting started using the PIC I would highly suggest that you at least consider switching to the Atmel. The prices are about the same but the ATMEL AVR is a completely modern architecture and doesn't have the 2kByte program space issue that the PIC has. Plus it is supposed to be much faster as all instructions execute in one clock cycle, so an 8 MHz device is 8 MIPS. As I mentioned, I started by looking at the PIC but when I found the Atmel AVR I was hooked. You can get devices (though certainly not the hundreds of choices you can find in the PIC) ranging from low end up to 128KBytes program space. http://www.atmel.com/dyn/products/param_table.asp?family_id=607&OrderBy=part _no&Direction=ASC Depending on the uC selected, the controllers I am using can have built in UARTs, as well as 1 wire (a misnomer) comms which are often more useful that UART in uCs. These are cool little widgets. The one thing they seem to be missing that you can get in the PIC are D to A converters, though with built-in PWM stuff you can use a PWM output and a filter to build a D to A. Given the prices, http://www.jameco.com/webapp/wcs/stores/servlet/CategoryDisplay?storeId=1000 1&catalogId=10001&langId=-1&categoryId=106010 http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&sto reId=10001&catalogId=10001&productId=204089&pa=204089PS (and you can get them even cheaper over on Digikey) I am looking at building functional blocks where little uCs each do one thing and they talk to each other over 1 wire. For my project I need a couple of PWM motor controllers talking to a central machine controller. The motor controller software could be run on the machine controller, or a little 20 pin uC could be placed out on a motor controller PCB with everything required to completely run a motor (Hbridge power MOSFETs circuits and the PWM micro), then it could just receive commands from the central controller - direction, speed and softstart ramp time - as instructions sent over the 1 wire interface. Assembly language is indeed easy, in fact way easier than 'C' to get started in. The biggest problem is that you have to really get into the instruction set and pneumonic for assembler whereas C shields you from that. There is a freeware C compiler that is available for my uC family. http://gcc.gnu.org/ If you stick with the PIC you might see if it is available for that as well. In the Atmel toolset it was a breeze to get set up and integrated into the IDE. I have my first C program running: #include <avr/io.h> #include <util/delay.h> void wait(void); int main (void) { // set PORTD for output DDRD = 0xFF; while(1) { for(int i = 1; i <= 128; i = i*2) { PORTD = i; _delay_loop_2(30000); } for(int i = 128; i > 1; i -= i/2) { PORTD = i; _delay_loop_2(30000); } } } Anyway, I am glad to hear you are into this and let's talk. This is going to be a lot of fun. Makes me wich I was retired so I didn't have to do real work. ;-) John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-tech-bounces at databaseadvisors.com [mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of Lembit Soobik Sent: Monday, September 25, 2006 4:05 AM To: Discussion of Hardware and Software issues Subject: Re: [dba-Tech] OT: Is anyone into controllers? YES, yes, here! I have been working since a few weeks on this and finished a program which reads from my EIB bus and displays the results on a 2 x 16 LCD. Things like Window in basement is open or such. It was pretty easy to get started. I am using assembly language and am surprised how easy it was. I have still a lot of plans with this and things that I have not found a good answer for, like communication with a PC,... I am using Microchip. I have got the ICD2 (debugger) and PICDEM 2 PLUS demo board, which I am using for programming. I have buildt the circuit hardware with one of these universal boards. have not yet made a pc-board. Right now I am building an Access db, which reads the .asm file and modifies it to insert customized message-texts. Microchip has forums and also a 7/24 support group (free). I am interested in participating in your forum. Lembit