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

help choosing a simple lcd and RAM

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







help choosing a simple lcd and RAM
PostPosted: Tue Aug 11, 2009 4:52 am     Reply with quote

Hi
i relay want to stay at my new job and need a quick solution to a system that i do Smile 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
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Tue Aug 11, 2009 5:01 am     Reply with quote

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.
treitmey



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

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

PostPosted: Tue Aug 11, 2009 8:15 am     Reply with quote

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..
jenn
Guest







thanks
PostPosted: Tue Aug 11, 2009 8:53 am     Reply with quote

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 !
mkuang



Joined: 14 Dec 2007
Posts: 257

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

PostPosted: Tue Aug 11, 2009 9:00 am     Reply with quote

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.
treitmey



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

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

PostPosted: Tue Aug 11, 2009 9:02 am     Reply with quote

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
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Tue Aug 11, 2009 9:26 am     Reply with quote

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 Smile

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.
jenn
Guest







PostPosted: Tue Aug 11, 2009 11:36 am     Reply with quote

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 Smile !

I really need a name of a rs232 screen as soon as possible.

thanks lot.
mkuang



Joined: 14 Dec 2007
Posts: 257

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

PostPosted: Tue Aug 11, 2009 12:13 pm     Reply with quote

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).
treitmey



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

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

PostPosted: Tue Aug 11, 2009 12:19 pm     Reply with quote

http://www.sparkfun.com/commerce/product_info.php?products_id=461
Guest








thanks
PostPosted: Wed Aug 12, 2009 12:41 am     Reply with quote

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) ?
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 12, 2009 7:56 am     Reply with quote

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.
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Wed Aug 12, 2009 1:01 pm     Reply with quote

I posted on your other thread...

might help

g
_________________
CCS PCM 5.078 & CCS PCH 5.093
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