CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

A/D to LCD, Crashing code

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sokrates



Joined: 14 Mar 2007
Posts: 12

View user's profile Send private message ICQ Number

A/D to LCD, Crashing code
PostPosted: Fri Mar 16, 2007 9:04 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Mar 16, 2007 9:16 am     Reply with quote

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

View user's profile Send private message ICQ Number

Locks up
PostPosted: Fri Mar 16, 2007 9:20 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Mar 16, 2007 9:35 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Mar 16, 2007 10:26 am     Reply with quote

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

View user's profile Send private message ICQ Number

removed LCD from the project
PostPosted: Fri Mar 16, 2007 2:50 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group