I've written the following program in bit instructions. How would I do the same program but using byte instructions?
Thanks for any help and time given.
/*
A program that transfers the state of the lower
5 DIL switches(RC0 - RC4) to the LED's (RA0 - RA4).(Byte Intructions)
*/
#include <p18f2221.h>
#pragma config OSC=HS /* 0.4us cycle time with 10MHz osc */
#pragma config WDT=OFF
#define Switch1 PORTCbits.RC0
#define LED1 PORTAbits.RA0
#define Switch2 PORTCbits.RC1
#define LED2 PORTAbits.RA1
#define Switch3 PORTCbits.RC2
#define LED3 PORTAbits.RA2
#define Switch4 PORTCbits.RC3
#define LED4 PORTAbits.RA3
#define Switch5 PORTCbits.RC4
#define LED5 PORTAbits.RA4
void main(void){
ADCON1=0x0f; /* digital IO */
TRISA=0xe0; /* 5 LEDs as outputs */
TRISC=0xff; /* PORTC as inputs */
PORTA=0x00; /* all LEDs off */
while(1){ /* forever */
if(Switch1) /* is switch open (non zero)*/
LED1=1;
else
LED1=0; /* turn LED on */
while(1){ /*Second Switch */
if(Switch2)
LED2=1;
else
LED2=0;
while(1){ /*Third Switch */
if(Switch3)
LED3=1;
else
LED3=0;
while(1){ /*Fourth Switch */
if(Switch4)
LED4=1;
else
LED4=0;
while(1){ /*Fifth Switch */
if(Switch5)
LED5=1;
else
LED5=0;
}
}