Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

MAX232 and ATtiny2313

Status
Not open for further replies.

Squintz

New Member
I have a circuit that uses only a ATtiny2313 and a MAX232N. Basically what the circuit is supposed to do is Start and stop a timer based on two switches and reset the timer with a third switch. The program then calculates speed and prints it to Hyperterminal.

Everything is working great except I cant send commands to the ATtiny2313

Turn the Power On
Hit the reset switch to ready the counter (or hit "R" from HyperTerm)
Hit the start Switch to start the counter
Hit the stop Switch to stop the counter
...The ATtiny2313 then calculates the speed and spits it out like it should.

However... When I press the "R" key on my keyboard to reset the timer it does not work and I cant figure out why. The chips transmit the data just fine but wont receive it.

My first question is how to I look at the signal with a scope?

From my trial I connected the scope ground to ground and the scope positive to pins 7 and 8 of the MAX232.

Pin 7 (Rx) = 8Vdc
Pin 8 (Tx) = 10Vdc

Pin 9 (MAX232) is connected to Pin 2 (ATtiny2313)
Pin 10 (MAX232) is connected to Pin 3 (ATtiny2313)

I am using 1uf Caps on pins 4 to 5, 1 to 3, 2 to +5v, and 6 to grnd of the MAX232.

I was thinking that there may be a bit not set right in my program but a friend of mine built what we think is the same circuit and he is able to receive data. He is using SIM boards from dontronics for most of his circuit which arepre built whereas I am doing everything from scratch with wire and protoboards.

Please help!
 
Always debug the hardware first. Then the software.

The MAX connections look correct. So next you need to look at your code. Post your code and we'll take a look.

Mike
 
code

Thanks for looking at thist for me. Here is my code. If you need it in another format I think I may be able to give it to you in assembly also but right now its in BASCOM-AVR which I am compiling and then using the AtmelStudio 4 to send it to the chip.
 

Attachments

  • eto.txt
    2.3 KB · Views: 548
Do you have the assembly file that your compiler created? I'm not familiar with BASCOM.

I don't see anywhere in your source code that tells the compiler you're using the ATtiny2313...So how does it know what port pins to use for serial comm?

Mike
 
Hi...

I noticed in the circuit diagram, you are using the max232 R2 as the receiver (pins 8 and 9) AND T2 as transmitter (pins 7 and 10)..

Instead, try using R1 as the receiver (pins 12 and 13) and T1 as transmitter (pins 11 and 14), I think you should get it working..
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top