View previous topic :: View next topic |
Author |
Message |
rubenskc
Joined: 28 Sep 2011 Posts: 12
|
LCD works in Proteus - fails in hardware |
Posted: Mon Oct 10, 2011 2:09 pm |
|
|
Hi guys... thanks for the flex_lcd.c, it's a dream, truly good stuff! The problem I have now:
I wrote a program for my 16F877A that compiles perfectly fine, and runs 100% well when using the generated .cof on my simulation on Proteus 7.1 SP4. LCD running so perfect that hurts! You should see!
However, when writing the .hex file to the actual PIC - nothing happens! Seems that the program "locks" or just freeze. No ideas. PIC plays dead. The programmer works fine - used dozens of times with no problem.... What am I doing wrong? Edited the flex_lcd.c, only altering the output pins.
That's my program
Code: |
#include <16F877A.h>
#device adc=8
#FUSES XT
#FUSES NOWDT
#FUSES NOPROTECT
#use delay(clock=4000000)
#include "flex_lcd.c"
void main()
{
setup_adc_ports(AN0_AN1_AN2_AN4_AN5_AN6_AN7_VSS_VREF);
setup_timer_1(T1_DISABLED);
setup_adc(ADC_CLOCK_DIV_2);
set_tris_C(0x00);
set_tris_D(0x00);
output_D(11111111);
setup_ccp1(CCP_PWM);
setup_timer_2(T2_DIV_BY_16,208,1);
set_pwm1_duty(50);
lcd_init();
delay_ms(10);
output_low(PIN_E0);
output_high(PIN_E0);
delay_ms(150); // beep buzzer
output_low(PIN_E0);
.
.
.
. |
_________________ Rubs |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Mon Oct 10, 2011 5:23 pm |
|
|
got a schematic of the hardware to post ??
sure the LCD is wired right??
that the contrast bias voltage is set so you can SEE the display?
hint: hardware less forgiving than PROTEUS
but can B just as buggy ;-))
this goofy line got my attention:
output_D(11111111);
??
do you mean '0b11111111'
what does PROTEUS think it means??
lastly as shown it does not compile anyway....... |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Tue Oct 11, 2011 1:17 am |
|
|
Seriously, when proteous is even mentioned, I immediately think "Sticky note: Proteus != live hardware"
I'm taking a wild guess that something is not write with the LCD and you're getting stuck in the while() loop that checks the busy flag of the LCD.
I don't have the code handy -- so I can't look... but you might consider starting there...
Got a scope I assume?
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
|