Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
while (PORTA == 0x04)
{
PORTB = 0xFF; //turning all the LED,s on
flash_delay();
PORTB = 0x00; //turning all the LED’s off
flash_delay();
}
if(PORTB == 0x04)
#include <p18f1320.h>
//#pragma config WDT = OFF
#pragma romdata CONFIG
_CONFIG_DECL(0x88,0x01,0x00,0x00,0x80,0x03,0xC0,0x 03,0xE0,0x03,0x40);
#pragma romdata
//*****************************************//
char flash_delay (void)
{
if (PORTA == 0x08)
{
// return with a value of 1
return 1; // 1 is passed back to the caller
}
else
{
int j;
for (j = 0; j < 1; j++);
// returning zero means button is not pushed
return 0;
}
}
//*************************************************//
void main (void)
{
ADCON0 = 0x1C;
ADCON1 = 0xFF;
OSCCON = 0xA6;
TRISA = 0x2C;
TRISB = 0x00;
PORTA = 0x00;
PORTB = 0x00;
if (PORTA == 0x04)
{
while (1)
{
PORTB = 0xFF; //turning all the LED,s on
if ( flash_delay() == 1)
{
break; // exit while loop because button is pressed
}
PORTB = 0x00; //turning all the LED’s off
if (flash_delay() == 1)
{
break; // exit while loop because button is pressed
}
}
}
}
#include <p18f1320.h>
//#pragma config WDT = OFF
#pragma romdata CONFIG
_CONFIG_DECL(0x88,0x01,0x00,0x00,0x80,0x03,0xC0,0x 03,0xE0,0x03,0x40);
#pragma romdata
//*****************************************//
char flash_delay (void)
{
int j;
for (j = 0; j < 1; j++);
}
//*************************************************//
void main (void)
{
ADCON0 = 0x1C;
ADCON1 = 0xFF;
OSCCON = 0xA6;
TRISA = 0x2C;
TRISB = 0x00;
PORTA = 0x00;
PORTB = 0x00;
if (PORTA == 0x04)
{
while (1)
{
PORTB = 0xFF; //turning all the LED,s on
flash_delay();
if (PORTA == 0x08)
{
break; // exit while loop because button is pressed
}
PORTB = 0x00; //turning all the LED’s off
flash_delay();
if (PORTA == 0x08)
{
break; // exit while loop because button is pressed
}
}
}
}
you are telling the posting engine what follows is a code listing and you do not want it to mess up the formating, mostly the indenting.
When you type
Thanks 3v0
I see what you mean about the return function, and I will study a bit more about the operands.
But I'm still a bit confused about pposting code onto the site and the use of tags.
Thanks
GreenP