Re: TI-H: More AVR Qs


[Prev][Next][Index][Thread]

Re: TI-H: More AVR Qs




>> 500kHz clock (saves power and gives you a little processing power)
>
>No, in this case it will be digital.

You could get away with a real slow clock.

>Specificly I have two
>phototransistors, one sensing ambiant light, one sensing ambiant + the light
>from a 2-5mW laser pointer at about 15M.  The ambiant light sensor is
>bypassed with a resister, output of the sensors is fed into a comparator,
>the output of which will be read by the AVR.

The comparator compares two voltages, so you'd have to have a refrence.

Each AVR pin can supply 20ma.  If you tie two together...

>This gives me 4 parts for the sensors, two phototransistors, a quad
>comparator and a resistor.
>Since the 1200 has an onboard analog comparator, and my phototransistors
>pass 20 mA at saturation, would it work to connect the emiters of the
>phototransistors to the 1200's comparator input, and the collectors to one
>or more port B or D pins?  The docs say that those pins can source some
>current, but not how much.
>This would eliminate the need for the external comparator chip.

>> You can put SRAM on a 1200 though it only has a 3 layer stack.
>
>How do you communicate with an SRAM chip?

Address, data, output enable, write enable...  Any SRAM doc will have the
timing available.

>Is that the communication protocol that would be the simplest to use with an
>external EEPROM?

3 wires is better than 20.  :)

Marshall will give you free samples of their I2C eeprom.  Look for the
atmel parts.

You could also use DataFlash.  for ~$4 you get 512kbyte and a SPI interface.


>Perhaps I should rephrase that, since you think building a mini-webserver
>with an AVR is not difficult :)

Well :) , all you have to is make a software uart that uses the external
interrupt for receive and the timer for clock...but all that work has
already been done.  You can either get a software uart or software
interrupt uart from atmel's www site.

If you REALY need serial, the 2313 is $1 more and has a hardware uart.


>Would it simply be a matter of hooking up the MAX232, connecting it to some
>pins on the AVR and pasting in some already written AVR code?

Yes.

>Or am I going
>to have to write AVR code to handle receiving bits myself?

One of the first things I did was to use their UART code.  That must have
been 2 years ago.  Its gotten better since then.

>> MAX232 works fine.  Get them free from maxim-ic
>
>Thanks for the refrence, I was acutally having trouble finding them locally.

Free samples!!!

>Another question, other than the fact that it is a HLL, do you have any
>information about the E-LAB Pascal compiler product?  It is a pascal
>compiler that will compile code for the AVR2313 and up (and several PIC
>micros).

There is a $99 C compilier for the AVR.  There are also a free "Keep it
simple yet powerful" pascal compiler.  I use IAR C to program insanely huge
programs and use ASM modules where C is too slow.

>Obviously the code it generates will not be as efficent as hand-coded ASM,
>but since few of my projects will require that kind of efficency, I'm
>considering using it where possable.

Your logging thing could use it.  The AVR runs rings arround what you need
to do.  :)

>The problem is that it doesn't work on the 1200 (I'm making a guess that it
>needs the onboard SRAM).

It needs a real stack.

>I was kind of hoping that someone might know of a
>way I could use the code it generates anyway, or of another free HLL for the
>AVR (I prefer pascal but micro compilers are all pretty easy to learn, so
>thats not a requirement.  Free or usable demo is a requirement.  E-LAB
>pascal is limited to <4k code in the demo, but thats not a problem for me).

Hua?  Do you mean write a routine and use the ASM thats generated?


Follow-Ups: References: