Hello everyone.
Please, I need of the help with code generated with codevision to atmega32 + lcd, it's working in proteus simulator, but not in physical circuit, was made to simple lcd of 4 bits, any can tell me why this happens, thanks...
Hello everyone.
Please, I need of the help with code generated with codevision to atmega32 + lcd, it's working in proteus simulator, but not in physical circuit, was made to simple lcd of 4 bits, any can tell me why this happens, thanks...
THINK: What things could possibly be different between the Simulation, and your physical circuit?
The most obvious is to check that your physical circuit actually matches what you simulated - isn't it?
Thanks awneil, the circuit and the schematic in the proteus are the same...
Take a picture of your hardware and post it, do you have bypass caps on all vcc/gnd pin pairs?
Do you have power on all VCC and AVCC pins?
What is your clock source, internal R/C or external Xtal?
What are your fuse settings?
Jim
Often Proteus allows implementations that will not work in the "real" world:
Showing a schematic of your physical system would help us help you.
The code..
Chip type : ATmega8535 Program type : Application AVR Core Clock frequency: 8,000000 MHz Memory model : Small External RAM size : 0 Data Stack size : 128 *****************************************************/ #include <mega8535.h> // Alphanumeric LCD Module functions #include <alcd.h> #include <delay.h> // Declare your global variables here void main(void) { // Declare your local variables here // Input/Output Ports initialization // Port A initialization // Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out // State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0 PORTA=0x00; DDRA=0xFF; // Port B initialization // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T PORTB=0x00; DDRB=0x00; // Port C initialization // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T PORTC=0x00; DDRC=0x00; // Port D initialization // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T PORTD=0x00; DDRD=0x00; // Timer/Counter 0 initialization // Clock source: System Clock // Clock value: Timer 0 Stopped // Mode: Normal top=0xFF // OC0 output: Disconnected TCCR0=0x00; TCNT0=0x00; OCR0=0x00; // Timer/Counter 1 initialization // Clock source: System Clock // Clock value: Timer1 Stopped // Mode: Normal top=0xFFFF // OC1A output: Discon. // OC1B output: Discon. // Noise Canceler: Off // Input Capture on Falling Edge // Timer1 Overflow Interrupt: Off // Input Capture Interrupt: Off // Compare A Match Interrupt: Off // Compare B Match Interrupt: Off TCCR1A=0x00; TCCR1B=0x00; TCNT1H=0x00; TCNT1L=0x00; ICR1H=0x00; ICR1L=0x00; OCR1AH=0x00; OCR1AL=0x00; OCR1BH=0x00; OCR1BL=0x00; // Timer/Counter 2 initialization // Clock source: System Clock // Clock value: Timer2 Stopped // Mode: Normal top=0xFF // OC2 output: Disconnected ASSR=0x00; TCCR2=0x00; TCNT2=0x00; OCR2=0x00; // External Interrupt(s) initialization // INT0: Off // INT1: Off // INT2: Off MCUCR=0x00; MCUCSR=0x00; // Timer(s)/Counter(s) Interrupt(s) initialization TIMSK=0x00; // USART initialization // USART disabled UCSRB=0x00; // Analog Comparator initialization // Analog Comparator: Off // Analog Comparator Input Capture by Timer/Counter 1: Off ACSR=0x80; SFIOR=0x00; // ADC initialization // ADC disabled ADCSRA=0x00; // SPI initialization // SPI disabled SPCR=0x00; // TWI initialization // TWI disabled TWCR=0x00; // Alphanumeric LCD initialization // Connections specified in the // Project|Configure|C Compiler|Libraries|Alphanumeric LCD menu: // RS - PORTA Bit 0 // RD - PORTA Bit 1 // EN - PORTA Bit 2 // D4 - PORTA Bit 4 // D5 - PORTA Bit 5 // D6 - PORTA Bit 6 // D7 - PORTA Bit 7 // Characters/line: 8 lcd_init(8); while (1) { lcd_puts("Carlos"); } }
In proteus working with 8mhz clock frequêncy.
Adding that with both the atmega32 and the atmega8535 this occurs, I'm finding this to be due to lcd, but it's new and I've already switched to another one the same ..
There seems to be a regulator wired up at the bottom R?/H side of the bread board but I can't see any MANDATORY bypass caps on that just as I can't see any on the chip itself.
But then I see that the pot's V+ is coming directly from VA.
Please do you drawing EXACTLY as wired up. ALL GND and VCC pins must be wired up and decoupled with bypass caps including AGND and AVCC, this is not optional.
EDIT I fixed yous code format, please use the code button when posing code <>, also as it has been pointed out the chip wiring is nothing like the schematic.
the circuit and the schematic in the proteus are the same...
No - it is now quite clear that they are not!!
Please do you drawing EXACTLY as wired up.
It would help if you also posted a photo in which we can see the connections to the LCD - in #6, they are hidden in shadow.
Also, if you could get a clear close-up of the connections at the microcontroller
please use the code button when posing code <>
Detailed instructions here: https://www.avrfreaks.net/comment...
CarlosConde wrote:the circuit and the schematic in the proteus are the same...No - it is now quite clear that they are not!!
That^^^^^
@OP...to start with, and it's not the only error, your schematic shows the LCD connected to Port A but on the breadboard it's on Port C.
your schematic shows the LCD connected to Port A but on the breadboard it's on Port C
+1
ALL GND and VCC pins must be wired up and decoupled with bypass caps including AGND and AVCC, this is not optional.
+100
(Emphasis mine)
unless you're a beginner who doesn't know how to solder ...
Yes I did this, and I already changed, in the image the wires were for atmega32, and I took the picture before having switched to atmega8535 ..
Thanks frog_jr, I see this, and I already changed, but remains the same..
How on earth do you expect people to help you when you post inaccurate/out-of-date information?!
Ok, start over, show us what you ACTUALLY have wired up, taking note of the suggestions above. We will not be able to help you if you post one thing but then change to something else!
Jim
I already changed and it's still the same, the photo was made with atmega8535, but the links were for the previous one that was atmega32..
But the code and schematic show the LCD connected to port A, the pic shows it connected to port C. So how can the code drive the LCD connected to the wrong port?
When asked, you said the schematic and the actual hardware where the same, they are not. Now, where do you think the problem is?
Jim
Is the back light LED connected?
edit: (I'm assuming you already corrected your wiring and connected the LCD to port A)
I'm an old technician, concert led televisions, soldering for me ceased to be novelty for at least 40 years ..lol... this kind of problem never happened, it is rare that I have these problems, I asked for help to see if anyone had already I will review everything again, the software and the hardware and see what can be happening, I return with news, thank you all ...
Yes, it's working ok, thanks..
So, since you have TV repair experience, I suppose you have an oscilloscope, have you checked if the signals are present in the data pins?
Yes, it's working ok, thanks..
Glad you got it working, come back again if you get stuck with another problem.
Ok I will and return, thanks..
It did not work, I just replied to friend El Tangas about the back light ...
I just replied to friend El Tangas about the back light ...
So make that clear by using the 'Quote' button to quote the specific person & point you're replying to ...
I already changed and it's still the same, the photo was made with atmega8535, but the links were for the previous one that was atmega32..
awneil wrote:CarlosConde wrote:the circuit and the schematic in the proteus are the same...No - it is now quite clear that they are not!!
That^^^^^
@OP...to start with, and it's not the only error, your schematic shows the LCD connected to Port A but on the breadboard it's on Port C.
I already changed and it's still the same, the photo was made with atmega8535, but the links were for the previous one that was atmega32..
CarlosConde wrote:I just replied to friend El Tangas about the back light ...So make that clear by using the 'Quote' button to quote the specific person & point you're replying to ...
Sorry, I will, thanks..
It's generally not useful to quote the entire post - just give enough context to show what you're replying to or commenting on.
Well, if we are sure of one thing today, it is that your wiring or fuses are at fault...
The only change I made to your code was to move the lcd_puts() call to outside the while(1) loop.
Well, if we are sure of one thing today it's that your wiring is at fault...
The only change I made to your code was to move the lcd_puts() call to outside the while(1) loop.
Thanks, I'll do it and go back..
I've lost track -- have we verified the row of black boxes? I.e., has the contrast circuit and level been shown to be correct?
https://www.avrfreaks.net/forum/b...
Adjust the contrast. You don't say the size of the display. A 2-line moderate-width character LCD that is uninitialized shows black boxes on the top line, and not on the bottom. Adjust your contrast until you see this. Remember I said "uninitialized". Hold your AVR in reset at power-up to enforce that.
...and the rest of that thread, and similar ones...
https://www.avrfreaks.net/comment...
https://www.avrfreaks.net/forum/l...
...
Another thing: Character LCDs start up much slower than an AVR. Delay some milliseconds after startup before attempting character LCD init.
Finally guys, the pie is ready, the problem was the lcd, I bought 2 and these with defect, I can now continue the code, thanks for your help, I'm available if anybody need....
That protoboard is an awful setup. I see no bypass capacitors. The crystal should be as close to the appropriate uC pins as possible. Those jumper wires are causing you trouble. Actually, I see the bypass caps are by the crystal. They should be as close to the power pins as possible. I have heard protoboards described as "slabs of trouble". It does no surprise me the circuit does not work.
Actually, I see the bypass caps are by the crystal.
I think it's more likely that those ones are supposed to be the crystal "burden" capacitors ?
Though they're probably pretty pointless on a solderless breadboard - as the usual few pF will be completely swamped by the breadboard.
I have heard protoboards described as "slabs of trouble".
Lol... It's is true, I configured with internal rc oscillator and the problem persisted, only after committing another lcd the thing worked...