Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Explain the C constructs line by line in this example 7-15 on page 264 that send

ID: 3552494 • Letter: E

Question

Explain the C constructs line by line in this example 7-15 on page 264 that sends a message to LCD. For example, what is #include, #define, unsigned, for etc.


#include <P18F458.h>

#define LCDData PORTB

#define En PORTCbits.RC2

void main(void)

{

unsigned char message[] = "The Earth is but One Country";

unsigned char z;

TRISB = 0;

TRISCbits.TRISC2 = 0;

for(z=0;z<28;z++)

{

LCDData = message[z];

En=1;

En=0;

}

while(1);

}


(3%) What do you use in C to do XOR operation?

(4%) How do you compute 16 divide by 3 with quotient 5 and remainder 1 using C language?

Explanation / Answer

15.makes corresponding port B as output pin ... i.e Output will be given to this pin
16. makes T1CLK pin an input pin
17. for loop starts..
18. parenthesis open

19 LCD recieves data to be outputted 28 times.. these data are stored in message array here data is "The Earth is but One Country"
20. PORTCbits.RC2 is set HIgh turns red led on to show we are writing
21. PORTCbits.RC2 is ser low.. turns red led off to give blinking type look.. (on off on off on off)



2. In c we use ^ sign to xor
suppose two numbers are 4 & 8
then to XOR these we write .... 4^8

3. to divide 16 by 3 ... we write quotient = (int) 16/3 ;
remainder = 16 % 3;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote