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

editing LCD.c driver

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



Joined: 24 Jun 2005
Posts: 206

View user's profile Send private message Send e-mail

editing LCD.c driver
PostPosted: Tue Aug 07, 2007 7:13 pm     Reply with quote

Hi All, I know that this could be done with the flex driver, but i would still like to know what the following two line mean in the ccs lcd.c driver

#byte lcd = 0xF81 (when using port b)

and

#byte lcd = 6 (when using port b)

I had a look in the datasheets, thinking it was a memory location, but the location on the datasheet for port b is 0xf85.

Could sombody please tell me what he two line do.

Thanks, Mark
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Wed Aug 08, 2007 8:29 am     Reply with quote

for lack of a better term, they "overlay" the variable created((lcd)) on top
of a memory location.
But these locations are special in that they are i/o ports.

The pins will still need the tris set properly,

but after that if you can say
lcd=0b01000100; //that is how the pin will be set.

and the same goes for reading.
int8 my_new_var;
my_new_var=lcd;//this reads the values on the pins.


ALSO keep in mind that different chips have the ports in different mem locations.
ie look at 18F452 spec page 47(45)
Quote:
F81h PORTB


Last edited by treitmey on Wed Aug 08, 2007 9:01 am; edited 3 times in total
Ttelmah
Guest







PostPosted: Wed Aug 08, 2007 8:49 am     Reply with quote

Question. Which data sheet has portb, at F85?. It is F81, on all the '18' chips I have used. 0xF85, is normally portf....
Double check the sheet.
The '6' location, is for '16' chips which have the ports mapped at the bottom of memory, instead of the top.

Best Wishes
Markdem



Joined: 24 Jun 2005
Posts: 206

View user's profile Send private message Send e-mail

PostPosted: Wed Aug 08, 2007 4:48 pm     Reply with quote

Thanks for that guys.

So my asamption was almost right. I did not see that the code is checking to see if I am using a 16F or 18F chip.
I should of said that ia am planing on using a 16F690, so i will need to use "#byte LCD = 7" if i want to use PORTC.

Ttelmah, you are right, 0xF85 is the TRISC location on the 16 chips, I just did not understand what the code was doing.

One more question, i checked that CCS help file, but still dont quite understand what #byte does. Is it just like declaring a veriable and then settting a vlaue for it?

Thanks, Mark
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Thu Aug 09, 2007 9:37 am     Reply with quote

Read my above reply.

What is read from the variable is the voltage level of the pins.


What is written to the variable is voltage set on pins.
that is 0 or 5V


but you need to set the tris
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