Hey
I would like to translate this "C" to Proton Compiler is for accelerometre.
There are parts of the program that I understand and some do not.
C Code:
volatile char sval[8]; Array of 8 element
void main()
{
unsigned char i;
unsigned char tmp; "tmp" with String
while(1) Bucle While
{
lcd_cmd(L_L1+1); I understand
lcd_str("x="); I understand
tmp=acc_read(0x6); I understand
if(tmp & 0x80) Returns the logical AND of two values ¿ I believe.... ?
{
tmp=~tmp+1; It makes the complement of the variable "~" tmp +1
sval[0]='-'; out sign - to LCD
}
else
sval[0]='+'; out sign + to LCD
sval[1]=((tmp)/100)+0x30; NO understand
sval[2]=((tmp%100)/10)+0x30; NO understand
sval[3]=(tmp%10)+0x30; NO understand
sval[4]=0; NO understand
lcd_str(sval); Out all to LCD
THX.
if(tmp & 0x80) Checks the sign bit (MSB bit, bit7), if the sign bit is 1, it means value is below zero
{
tmp=~tmp+1; It makes the complement of the variable "~" tmp +1,
//so the new tmp value is valid for the next operation
sval[0]='-'; out sign - to LCD
}
else
sval[0]='+'; out sign + to LCD //only this line is for the else statement
/next 5 lines of codes are used for both if and else statements, because of there is any { } signs for the borders of the else statement,
//else command only proceed the one line after the else statement.
sval[1]=((tmp)/100)+0x30; NO understand // it makes the decimal MSB digit from the value of temp (hundreds )
sval[2]=((tmp%100)/10)+0x30; NO understand //likewise makes the next digit (tens),
//(tmp % xxx) means what is remainder of tmp div xxx
sval[3]=(tmp%10)+0x30; NO understand // next digit (ones), why it adds 0x30, because Charecter LCD takes numbers as this
sval[4]=0; NO understand //0x30 for 0, 0x31 for 1, 0x32 for 2 so on.
lcd_str(sval); Out all to LCD
[\code]
Bir ingilizce foruma türkçe soru sorsaniz. Muhtemelen burada türkçe konuşamazsiniz olur
Discovery II Mini cihazımdan Tapatalk kullanılarak gönderildi
Alıntı yapılan: run - 15 Eylül 2016, 16:51:30
Bir ingilizce foruma türkçe soru sorsaniz. Muhtemelen burada türkçe konuşamazsiniz olur
Discovery II Mini cihazımdan Tapatalk kullanılarak gönderildi
Soru soran arkadaş ara ara foruma yazan yabancı biri. Daha önce google translate ile türkçe sorular sordu. Çeviri kötü olduğu için ingilizce sorması istendi. Yanlış bir durum yok bence. sanırım siz ilk defa karşılaşıyorsunuz.
Alıntı yapılan: run - 15 Eylül 2016, 16:51:30
Bir ingilizce foruma türkçe soru sorsaniz. Muhtemelen burada türkçe konuşamazsiniz olur
İspanyolca yazılan bir forumda güzel bir kütüphane bulmuştum,
aklıma takılan yerleri İngilizce yazmıştım,
google çeviri ilede İspanyolca-İngilizce çevirisini eklemiştim,
İspanyolca İngilizceye makinayla çok iyi çevriliyor ayrı mesele.
İspanyol forumda İngilizce yazmamı kimse yadırgamamıştı, yardımcıda olmuşlardı.
Ben İngilizce bilen birinin o kadar alternatifi varken,
Türk forumundan yardım istemesinden zevk duyarım.