Forum Replies Created
-
AuthorPosts
-
umar farrok
Participantmax=val; (variable with 8 bit data type)
for two digit , three digit use the i value for example,
three digit
for(i=0;i<=2;i++)
{
temp=max/10;
max=max%10;
}
umar farrok
Participantfirst you have to be clear you create a delay by using hardware or software delay by using timer circuit or using timer calculation in the code depends upon that you have to choose your pin as gate is 0 or gate is 1
umar farrok
Participantthere may be a voltage lag or corresponding voltages not reached to the pins check that when pressing switch logic high is passing in that corresponding line
umar farrok
Participantcheck the macros in your code
umar farrok
Participantjeni try this
CODE:;***************************************
;Ports Used for I2C Communication
;***************************************
sda equ P0.0
scl equ P0.1;***************************************
;Initializing I2C Bus Communication
;***************************************
i2cinit:
setb sda
setb scl
ret;****************************************
;ReStart Condition for I2C Communication
;****************************************
rstart:
clr scl
setb sda
setb scl
clr sda
ret;****************************************
;Start Condition for I2C Communication
;****************************************
startc:
setb scl
clr sda
clr scl
ret;*****************************************
;Stop Condition For I2C Bus
;*****************************************
stop:
clr scl
clr sda
setb scl
setb sda
ret;*****************************************
;Sending Data to slave on I2C bus
;*****************************************
send:
mov r7,#08
back:
clr scl
rlc a
mov sda,c
setb scl
djnz r7,back
clr scl
setb sda
ret;*****************************************
;ACK and NAK for I2C Bus
;*****************************************
ack:
clr sda
setb scl
clr scl
setb sda
retnak:
setb sda
setb scl
clr scl
setb scl
ret;*****************************************
;Receiving Data from slave on I2C bus
;*****************************************
recv:
mov r7,#08
back2:
clr scl
setb scl
mov c,sda
rlc a
djnz r7,back2
clr scl
setb sda
ret
? Assembly Implementation:
CODE:#define SDA P0_0
#define SCL P0_1void I2CInit(){
SDA = 1;
SCL = 1;
}void I2CStart(){
SCL = 1;
SDA = 0;
SCL = 0;
}void I2CRestart(){
SCL = 0;
SDA = 1;
SCL = 1;
SDA = 0;
}void I2CStop(){
SCL = 0;
SDA = 0;
SCL = 1;
SDA = 1;
}void I2CAck(){
SDA = 0;
SCL = 1;
SCL = 0;
SDA = 1;
}void I2CNak(){
SDA = 1;
SCL = 1;
SCL = 0;
}void I2CSend(unsigned char Data){
unsigned char i;
for(i=0;i<8;i++){
SCL = 0;
if((Data&0x80)==0)
SDA = 0;
else
SDA = 1;
SCL = 1;
Data<<=1;
}
SCL = 0;
SDA = 1;
}unsigned char I2CRead(){
unsigned char i, Data=0;
for(i=0;i<8;i++){
SCL = 0;
SCL = 1;
if(SDA)
Data |=1;
Data<<=1;
}
SCL = 0;
SDA = 1;
return Data;
}
umar farrok
Participantuse this link you will get some idea
http://www.8051projects.net/i2c-twi-tutorial/8051-i2c-implementation.php
umar farrok
Participantthe reason is to convert your analog value of your temp values using adc reference pin of adc is the main consideration . exmple for 1c what is the voltage value you have to know. from that you do some simple calc and set that voltage level in your adc ref pin
you will get correct values
umar farrok
Participantin assembly i am not very well in that i am doing program using embedded c if you are familiar with that mean i send sample code to access smartcard i2c with controller jeni
umar farrok
Participantrpm, power rating, degree
umar farrok
Participantif you are using lm 35 or lm 34 as temperature sensor that range should be -55 to 150 c for lm35 . you simply get the analog values of temp sensor and passed to adc single or multi channel and from that digital values you add that with 0x30 or 48 with your original temp value to get correct value as well as resolution, reference calc is also one of the important parameter .
umar farrok
Participantif communication is between pc to pc, controller to db-9 ,pin 2,3 and 5 enough . txr to rxr , rxr to txr gnd to gnd
umar farrok
Participantinterface gsm is quite simple now in today technology either by rs232 cable with or usb cable .
umar farrok
Participantadd your data with (data+0x30) or(data +48) in order to get your correct value.
umar farrok
Participantsaranda it depends upon the compiler you have usen may be ide wont support more than 2bytes , 4bytes like that first you check your ide as well as the os for the system you are using . where you use 64 bit? for which processor you are using this , if you provide some details it may helps to go on further.
March 28, 2013 at 6:52 am in reply to: Regarding help for developing a microcontroller projects #9385umar farrok
Participanthi daya first of all you know the each and every details about the controller you have get the pdf details about the controller details like ram , rom, external memeory size , data bit address bit, sfr’s everything then try small program with your controller like port led blinking likewise first of all try this willl let you know after you complete this task ok va have a nice day to you
-
AuthorPosts