473,395 Members | 1,488 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Pic-c Variables

Hi guys;

I am working on a robot project and have a problem which is:

There are two microcontroller system and first one is scanning a 12*8 keypad, that pic gets the adress of key and sends data to other pic in i2c routines. Upto number 63 in decimal everything is ok, but above 63 the data is corrupted, if i explain in this way;

(64)decimal = (40)hex = (01000000)bnry, but the number above 64 becomes such: (64)decimal = (11000000)bnry in i2c data transfering.

I could not find mistake, thanks in advance....
Apr 27 '06 #1
3 2717
Banfa
9,065 Expert Mod 8TB
You have described the problem but not provided any context, I can not believe that the fact the corruption starts at the first value where bit 7 is 1 rather than 0 which suggests a problem in the way the i2c is being driven/configured.

Have you tried other numbers >64? are they corrupted in the same way (i.e. bit 8 set erroneously)? Have you tried the value 128 ( = 80 hex = 10000000 binary)?
Apr 27 '06 #2
Thanks for your interest, Banfa.

I tried your advice, for 128 there seem to be no mistake. I am beginner in c programming and wonder if that problem can cause because of choosing wrong variables, i thought "unsigned char" may be enough for variables in program for such a 8-bit microcontroller.

Good lucks in yoru jobs....
Apr 28 '06 #3
Banfa
9,065 Expert Mod 8TB
unsigned char is probably fine, it is 8 bits in most systems although there are some systems in which it is 7 or 9 bits. However you should be able to verify the number of bits in your bytes easily by looking for the symbols

#define CHAR_BIT 8 /* number of bits in a char */
#define UCHAR_MAX 0xff /* maximum unsigned char value */

in limits.h in the headers supplied with your compiler.
Apr 28 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Treetop | last post by:
I have code that works in IE but not Netscape 7+. This code allows me to have a list of links that bring up an image and description in an iframe. This works great in IE, however I have users...
10
by: Neal | last post by:
Hi, new here. I'm designing a site. The page in question has a navbar on left taking 15% of the screen. A header, containing a centered graphic, requires about 200px. What I want is to have a...
2
by: Astra | last post by:
Hi All I know the subject may sound weird so hopefully the below will explain. 1) I'm creating an estate agent web site, which will display a 1 x jpg pic and say 4 text descriptions for each...
4
by: tmb | last post by:
I want to do a slide show with a script something like http://www.abiglime.com/webmaster/articles/jscript/021298.htm My Question: Will the client wait on all pic's in the slice show to be...
1
by: carverk | last post by:
Hello I have On a form an Unbound Picture (BMP) that I would like to be able to change by clicking on it and having it got display the next Pic in the List. Like This: I Open The Form...
3
by: Ramon | last post by:
Hi all, I want to write some data on the EEPROM of a PIC 16F877 microcontroller via serial port rs232. What library can I use with a gcc compiler to perform this ? Thank you very much ! ...
1
by: roN | last post by:
Hi, I have 3 small images and 3 big images, i would like to display the big one, when the small one is clicked, I tried: IA1 = new Image(); IA1.src = "./images/IA-demo-big_1.jpg"; /*...
0
by: =?Utf-8?B?WWFlbA==?= | last post by:
I created a com add-in for outlook 2003 in vs.net 2003 c#. if I calling stdole.IPictureDisp Pic = MatarotHost.ImageToIPicture(Image.FromStream(imgStreamPic)); And I don't have a vs.net installed...
3
by: Zaccy | last post by:
im trying to do this assignment for skool and i have completely forgot how to do this. i have 2 pic boxes and 1 button wen i click that button i want it to get a random number diff one for both but...
2
by: adisabat | last post by:
Hi I was linking a lot of libraries on Solaris10 sun studio 12 and I got the following errors: ld: fatal: too many symbols require `small' PIC references: have 3942, maximum 2048 --...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.