![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
jennifer Guest
|
help choosing a simple lcd and RAM |
Posted: Tue Aug 11, 2009 4:52 am |
|
|
Hi
i relay want to stay at my new job and need a quick solution to a system that i do have experience with pic's and ccsc.
In my work, i need to control a 5 step motors and put a small screen, and also a relay small external memory of couple of words.
i have chosen the pic16f877 40 pins , and now i need to choose lcd,ram.
please give me advise of a small popular screen- one or two words- black and white(or just one other color),one line, who can be simply fit the pic16f877 and is easy to use\ i can find code for it.
other thing is the smallest external memory even few bytes, that can fit the pic16f877, i prefer a MicroChip one. or if there is other way to save data in a pic after i turn it off will be good.
please,if you have a chip name,and a specific lcd,that would be good.
thanks a lot.
jenn |
|
![](templates/subSilver/images/spacer.gif) |
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Tue Aug 11, 2009 5:01 am |
|
|
For the memory just use the EEPROM or even the flash of the pic it'self to store the data, depending on how often the data will change. |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Tue Aug 11, 2009 8:15 am |
|
|
First off, why do you want external memory?
There better be a good reason. for just a few bytes ((x<25))
And how many boards are you making. 1-10 25,50,100,1000?
for a LCD try a standard 2x16 found everywhere.
http://microcontrollershop.com/product_info.php?products_id=1464
if it needs to be viewed outside in sunlight you may need something special, like super twist, ect.. |
|
![](templates/subSilver/images/spacer.gif) |
jenn Guest
|
thanks |
Posted: Tue Aug 11, 2009 8:53 am |
|
|
thanks!
i was trying to write to eeprom and it didnt worked.
can someone give me a simple code to write eeprom ?
and about the screen-this screen is steel produced ? is it rs232 ?
thanks ! |
|
![](templates/subSilver/images/spacer.gif) |
mkuang
Joined: 14 Dec 2007 Posts: 257
|
|
Posted: Tue Aug 11, 2009 9:00 am |
|
|
Which eeprom? Internal or external? Post a part number if you are using an external one.
Also I wouldn't be comfortable with the PIC you chose, it only has 8K x 14 of flash which does not seem sufficient for doing what you want to do. |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Tue Aug 11, 2009 9:02 am |
|
|
Here is a 16x2 you can buy from digi-key. many others are available.
It is not serial it uses min 6 pins. d4-d7,Rs,E, and then ground Rw
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=NHD-0216K1Z-NSW-BBW-L-ND
Code: | #define FIRM_MINOR 17
#define FIRM_MAJOR 'K'
#define HARD_MAJOR 0
#define HARD_MINOR 0
#include <16F877a.h>
#device *=16
#fuses hs,nowdt,noprotect,nolvp,put
#use delay(clock=11059200,RESTART_WDT)
#use rs232(baud=19200,xmit=PIN_B3,invert,stream=debug)
#case
//#zero_ram
#rom 0x2100={1,2,3,4}
void main() {
BYTE i, j, address, value;
fprintf(DEBUG,"\r\n\nICD-U40 EEPROM:\r\n");// Display contents of the first 64
for(i=0; i<=3; ++i) { // bytes of the data EEPROM in hex
for(j=0; j<=15; ++j) {
printf( "%2x ", read_eeprom( i*16+j ) );
}
}
printf("\n\r");
address = 0x2102;
value = 0xBB;
write_eeprom( address, value );
fprintf(DEBUG,"\r\n\nUser change 0x2102 to 0xBB \r\n");// Display contents of the first 64
for(i=0; i<=3; ++i) { // bytes of the data EEPROM in hex
for(j=0; j<=15; ++j) {
printf( "%2x ", read_eeprom( i*16+j ) );
}
}
while (1);
}
|
Code: | #include <18F452.H>
#case
#use delay(clock=40000000)
#fuses h4,nowdt,noprotect,nolvp
#use rs232(baud=19200,xmit=PIN_C0,invert,stream=DEBUG,disable_ints)
#zero_ram
void MyWrite_EEPROM(int16 addr, int8 value);
void main(void){
set_tris_c(0xFF);set_tris_a(0);set_tris_b(0);set_tris_d(0);set_tris_e(0);
setup_adc_ports(NO_ANALOGS);
printf("Start\n\r");
printf("loc1=0x%X\n\r",read_eeprom(1));
printf("loc2=0x%X\n\r",read_eeprom(2));
printf("loc3=0x%X\n\r",read_eeprom(3));
printf("loc4=0x%X\n\r",read_eeprom(4));
MyWrite_EEPROM(1,2);
MyWrite_EEPROM(2,3);
MyWrite_EEPROM(3,4);
printf("loc1=0x%X\n\r",read_eeprom(1));
printf("loc2=0x%X\n\r",read_eeprom(2));
printf("loc3=0x%X\n\r",read_eeprom(3));
printf("loc4=0x%X\n\r",read_eeprom(4));
printf("DONE\n\r");
while(1)
{
}
}
//=== MyWrite_EEPROM ==========================================================
void MyWrite_EEPROM(int16 addr, int8 value)
{
int8 current;
// First Read data. Then only write if the information is different
// Takes longer but cuts down on writes that can wear out the eeprom
current = read_eeprom(addr);
if (current != value){
write_eeprom(addr, value);
}
}
|
Last edited by treitmey on Tue Aug 11, 2009 9:41 am; edited 1 time in total |
|
![](templates/subSilver/images/spacer.gif) |
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Tue Aug 11, 2009 9:26 am |
|
|
mkuang wrote: | Which eeprom? Internal or external? Post a part number if you are using an external one.
Also I wouldn't be comfortable with the PIC you chose, it only has 8K x 14 of flash which does not seem sufficient for doing what you want to do. |
I think you should read his first post again
Quote: | and also a really small external memory of couple of words. |
Quote: | other thing is the smallest external memory even few bytes, that can fit the pic16f877, i prefer a MicroChip one. or if there is other way to save data in a pic after i turn it off will be good. |
I think he will find that the pic16f877 which offers both 8K x 14 words of flash and 256 x 8 bytes of EEPROM will be just fine for what he wants. Unless his spec is wrong. |
|
![](templates/subSilver/images/spacer.gif) |
jenn Guest
|
|
Posted: Tue Aug 11, 2009 11:36 am |
|
|
Thanks everybody.
I just need to use internal eeprom and need the 2 words for this command.
and only need a normal screen that uses rs232 (modern!!), and popular.
That's 2 things that will save my system and job !
I really need a name of a rs232 screen as soon as possible.
thanks lot. |
|
![](templates/subSilver/images/spacer.gif) |
mkuang
Joined: 14 Dec 2007 Posts: 257
|
|
Posted: Tue Aug 11, 2009 12:13 pm |
|
|
Quote: |
I just need to use internal eeprom and need the 2 words for this command.
|
The CCS functions to access internal eeprom are write_eeprom(ADDX, value) where ADDX is the EEPROM address and value is an eight bit integer;
and read_eeprom(ADDX). |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
thanks |
Posted: Wed Aug 12, 2009 12:41 am |
|
|
THANKS A LOT.
It helped me so much.
I just couldn't understand what is the "lcd init" commands.
Does the PIC know a specific lcd? I need to send words in rs232 no ?
Can I find example code for a lcd (parallel and serial) ? |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Wed Aug 12, 2009 7:56 am |
|
|
Where did you see lcd_init()??? in the lcd.c library.
That library was written for the common 2x16 LCD using
d4-d7,Rs,E, and then ground Rw. That library is not for the serial
LCD that you said you wanted. |
|
![](templates/subSilver/images/spacer.gif) |
Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
|
|
Posted: Wed Aug 12, 2009 1:01 pm |
|
|
I posted on your other thread...
might help
g _________________ CCS PCM 5.078 & CCS PCH 5.093 |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|