Discussion in "Project Doubts" started by    onyot    Nov 23, 2010.
Mon Dec 13 2010, 07:21 AM
#91
Sir ExperimenterUK, I just wanna ask that, does atmel's 8051 can handle 35 codes (referring to what my example)?
And what do you mean by the note above, especially the second sentence?
Mon Dec 13 2010, 07:29 AM
#92
hi onyot.josephian

Sir ExperimenterUK, I just wanna ask that, does atmel's 8051 can handle 35 codes (referring to what my example)?


yes can handle 35 codes store code in rom then it can handle

Note:
stockLevels are only bytes, and atol() returns a "long" value.
The compiler may need to be told to convert a "long" to a "uchar".


he said that may be compiler give u error when u use atoi () function
because it returns long data type


[ Edited Tue Dec 14 2010, 04:16 AM ]
Mon Dec 13 2010, 07:43 AM
#93
ah.... Thanks sir majoka.....
Mon Dec 13 2010, 08:04 AM
#94
welcome onyot.josephian
do concentrate on ur work and dnt worry about these hurdles it will come with respect to time ans will solved here
dnt worry
Mon Dec 13 2010, 08:44 AM
#95
nice majoka, i seen you for the second time using smiley.. lol.. aheheheeh..
Mon Dec 13 2010, 07:36 PM
#96


Sir ExperimenterUK, I just wanna ask that, does atmel's 8051 can handle 35 codes (referring to what my example)?
And what do you mean by the note above, especially the second sentence?

onyot.josephian



Which 8051 device are you using ?
The original has limited rom and ram so may not be good enough for your task.

As majoka said atoi() and atol() return values larger that the 8 bit value I used to store the stock level.

We know this and are happy to just keep the 8 bit value,
but the compiler will usually warn of a problem.
To avoid the warning we tell the compiler what we want to do by using a "cast".
uchar result;   

result = atoi(keyBuffer);   //compiler not happy 
result =(uchar) atoi(keyBuffer);    //compiler  happy 


Obviously if your stock level is over 255 you need to use integers for storage.


//Create an array of stock codes in ROM/program memory.. 5 in this example.
//and an array of storage bytes in Ram.

long stockCodes[]={707021,345678,232345,334455,998877};
uchar stockLevels[]={0,0,0,0,0};


Micros treat rom/program storage differently to ram storage.
The compiler has to be told what is is is rom somehow.
I don't know yours well enough to give examples, so check it out for yourself
or your program will compile but not work.
 romel_emperado like this.
Thu Dec 16 2010, 12:00 AM
#97
Sir ExperimenterUK
I am using at89c2051...
Do you have any suggestion what microcontroller should I use?
Does the program above, should be in void main () or not?
What about if I use AT89S52? is it okay?

And what do you mean by the char index=0?
should I make index=1 in the next line?

does uchar stockLevels[]=(0,0,0); mean that every 0 will represent the numbers in long stockCodes, am I right?


[ Edited Thu Dec 16 2010, 03:15 AM ]
Thu Dec 16 2010, 04:13 AM
#98
Hi onyot, if your code size is more that 2k then you must use higher flash memory storage like AT89s52/AT89s52..

does uchar stockLevels[]=(0,0,0); mean that every 0 will represent the numbers in long stockCodes, am I right?


yes, you store in the array every stockcodes you want..
in accessing the array, remember that you must always start to zero location of the array


[ Edited Thu Dec 16 2010, 04:16 AM ]
Thu Dec 16 2010, 06:50 AM
#99
if u want to in between 20 pins controller and memory size is greater than 2 k then u can use at89c4051
it has 4k flash and 128 byte ram with 2 ports
 onyot.josephian like this.
Thu Dec 16 2010, 05:29 PM


Sir ExperimenterUK
I am using at89c2051...
Do you have any suggestion what microcontroller should I use?

onyot.josephian


Anything but an 89c2051

An AT89S52 looks like a good choice, lots of ram and program space.


And what do you mean by the char index=0?
should I make index=1 in the next line?

onyot.josephian


This is simply creating a variable called index with a starting value of 0.
You increment index as you compare the user input with stockCodes in a loop.


does uchar stockLevels[]=(0,0,0); mean that every 0 will represent the numbers in long stockCodes

onyot.josephian


There is one "stockLevels" for each "stockCodes",initially 0.


Get Social

Information

Powered by e107 Forum System

Conversation

Fri Dec 13 2019, 08:50 PM
Estela Isenberg
Chris
Thu Dec 12 2019, 09:16 PM
enrexzweuz
qdimekzibi
Thu Nov 21 2019, 12:30 PM
raj2555
how to interface 8051 microcontroller with NRF24L01+ module
ExperimenterUK
Sat Oct 12 2019, 10:23 PM
Log in.. then post your code in the 8051 forum
Sat Oct 12 2019, 10:18 AM
Bhadra Sajikumar
i am doing a countdown timer with 8051 for my project, unfortunately our professor had to take a leave of absence before he could teach us most of it.. can someone explain the .asm code of it for me?
Mon Sep 23 2019, 07:37 AM
Nathaniel
I am doing a project for my schools wireless security system with cameras,sensors and spot lights using 8051 micro controller, could you help me out with the design and its source code.
Wed Sep 18 2019, 08:48 PM
Caryn Kover
Thank you for your time,
ExperimenterUK
Mon Aug 05 2019, 07:09 PM
@Ismail ..post in forum, give details
Mon Aug 05 2019, 04:33 PM
Ismail balghmi
Hello. Please I won't download
ExperimenterUK
Wed Jul 24 2019, 12:47 AM
@BUSTER123 Please post in the forum

Downloads

Comments

Istika
Thu Dec 12 2019, 12:04 PM
nabiha_anaya
Sun Dec 08 2019, 09:16 AM
ananyagupta
Tue Dec 03 2019, 07:53 AM
wells
Mon Nov 25 2019, 08:25 PM
auwal
Tue Nov 19 2019, 03:13 PM
ANKITPATEL
Mon Nov 18 2019, 11:00 AM
Casmir
Wed Nov 13 2019, 06:25 AM
DeepakBGattani
Mon Nov 11 2019, 01:31 PM

Online

Guests: 40, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 38109
Newest member: Istika
Forum Activity
ilylily07 Avatar
Posted By ilylily07
Thu Dec 12 2019, 02:26 PM
wil do.thank you for your advice!
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Dec 12 2019, 07:13 AM
Something like this ?https://www.bing.com/videos/s...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Dec 12 2019, 06:58 AM
The layout is a bit different, but it is the same ...
ilylily07 Avatar
Posted By ilylily07
Thu Dec 12 2019, 04:38 AM
https://i.imgur.com/6S5FcwF.png right now im follo...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Dec 10 2019, 04:49 PM
ilylily07 Avatar
Posted By ilylily07
Sun Dec 08 2019, 01:24 PM
Hi .im humbly ask for your advice as i wrongly pur...
nabiha_anaya Avatar
Posted By nabiha_anaya
Sun Dec 08 2019, 09:19 AM
My teacher assign me a project on "voice control h...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Nov 29 2019, 04:24 AM
" Is it possible to interface a fingerprint scanne...
ilylily07 Avatar
Posted By ilylily07
Thu Nov 28 2019, 03:50 PM
You will not find any code for an 8051 as no one w...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Nov 26 2019, 05:44 PM
You will not find any code for an 8051 as no one w...