View previous topic :: View next topic |
Author |
Message |
sokrates
Joined: 14 Mar 2007 Posts: 12
|
A/D to LCD, Crashing code |
Posted: Fri Mar 16, 2007 9:04 am |
|
|
Is there anything terribly wrong about the following code?
I am only trying to send digital data to an LCD. MY simulation set-up uses Port B for all LCD connections ( in the correct order ), however whenever I try to simulate with this code, my Proteus crashes very badly.
Code: | #include <18F452.h>
#device adc=10
#fuses HS, noprotect, nowdt, nolvp
#use delay(clock=10000000)
#include <lcd.c>
#include <stdio.h>
void main()
{ char result2[20];
double result;
setup_port_a(ALL_ANALOG);
setup_adc(ADC_CLOCK_DIV_8);
set_adc_channel(0);
delay_us(20);
while(1) {
lcd_init();
result = read_adc();
sprintf(result2,"%f",result);
lcd_putc(result2);
delay_ms(500);
}
} |
and I didn'T forget to uncomment the necessary line in lcd.c that selects Port B as LCD driver
Thank you in advance |
|
|
rberek
Joined: 10 Jan 2005 Posts: 207 Location: Ottawa, Canada
|
|
Posted: Fri Mar 16, 2007 9:16 am |
|
|
What do you mean by "crashes"? Does it crash with an error message? Is it an official version or a hacked version?
r.b. |
|
|
sokrates
Joined: 14 Mar 2007 Posts: 12
|
Locks up |
Posted: Fri Mar 16, 2007 9:20 am |
|
|
It simply locks up.
It says "animating" above but it does not nothing and I have to close it from the task manager each time.
It's not an official version, but it can simulate many sample programs, and also some of the programs that I designed.
So there must have been something wrong with my configuration.
Thanks in advance |
|
|
rberek
Joined: 10 Jan 2005 Posts: 207 Location: Ottawa, Canada
|
|
Posted: Fri Mar 16, 2007 9:35 am |
|
|
Well, if this is a demo version of Proteus, then the samples will simulate correctly, but changing any of the code in the sample, or writing new code for the PICs won't work. At least as I understand it.
If this is a non-demo version that hasn't been registered, it is designed to occasionally not work properly without the proper key, so it could be something in your code or your configuration, or it may be Proteus having a bit of fun with you.
I suggest going over to http://www.labcenter-electronics.com and joining the user forum to ask for some assistance. Not many people here use this software.
r.b. |
|
|
rberek
Joined: 10 Jan 2005 Posts: 207 Location: Ottawa, Canada
|
|
Posted: Fri Mar 16, 2007 10:26 am |
|
|
If you want, post a screen capture of the circuit and we might be able to provide some assistance. |
|
|
sokrates
Joined: 14 Mar 2007 Posts: 12
|
removed LCD from the project |
Posted: Fri Mar 16, 2007 2:50 pm |
|
|
I removed my LCD ( it was not needed in the project ) chip,
and placed 10- LEDs instead of the LCD, I was just trying to see a correct A/D operation.
Now it works fine.
Thank you so very much for your assistance
sokrates |
|
|
|