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.
this code is not working,when pressing RB0 RB4 should flash ,RB1 RB5 should flash ,
RB2 RB6 should flash ,RB3 RB7 should flash ,
but nothing isn't working
code:
#include <pic18.h>
#include <config.h>
#include <delay.h>
main(void){
TRISB = 0x0F; //RB4,RB5,RB6 and RB7 are outputs, others inputs
RB4 = 0; // turn LED off
RB5 = 0; // turn LED off
RB6 = 0; // turn LED off
RB7 = 0; // turn LED off
while(1)
{
//if((RB0=1) & (RB1=1) & (RB2=1) & (RB3=1))
//DelayMs(30);
if(!RB0) RB4=1;
else if(!RB1) RB5=1;
else if(!RB2) RB6=1;
else if(!RB3) RB7=1;
//if(!(RB0 & RB1 & RB2 & RB3))
//DelayMs(30);
else
RB4 = 0;
RB5 = 0;
RB6 = 0;
RB7 = 0;
}
}
I've never used the Oshonsoft simulator but would imagine that it runs a hex file and imports some file for debug information. A bit like MPLAB, it don't care on the language.
My only comment is that birdman0_o had a good suggestion, you need braces around your last else.
Mike.
this code is not working,when pressing RB0 RB4 should flash ,RB1 RB5 should flash ,
RB2 RB6 should flash ,RB3 RB7 should flash ,
but nothing isn't working
code:
#include <pic18.h>
#include <config.h>
#include <delay.h>
main(void){
TRISB = 0x0F; //RB4,RB5,RB6 and RB7 are outputs, others inputs
RB4 = 0; // turn LED off
RB5 = 0; // turn LED off
RB6 = 0; // turn LED off
RB7 = 0; // turn LED off
while(1)
{
//if((RB0=1) & (RB1=1) & (RB2=1) & (RB3=1))
//DelayMs(30);
if(!RB0) RB4=1;
else if(!RB1) RB5=1;
else if(!RB2) RB6=1;
else if(!RB3) RB7=1;
//if(!(RB0 & RB1 & RB2 & RB3))
//DelayMs(30);
else
RB4 = 0;
RB5 = 0;
RB6 = 0;
RB7 = 0;
}
}
#include <pic18.h>
#include <config.h>
#include <delay.h>
main(void){
TRISB = 0x0F; //RB4,RB5,RB6 and RB7 are outputs, others inputs
RB4 = 0; // turn LED off
RB5 = 0; // turn LED off
RB6 = 0; // turn LED off
RB7 = 0; // turn LED off
while(1)
{
//if((RB0=1) & (RB1=1) & (RB2=1) & (RB3=1))
//DelayMs(30);
if(!RB0) RB4=1;
else if(!RB1) RB5=1;
else if(!RB2) RB6=1;
else if(!RB3) RB7=1;
//if(!(RB0 & RB1 & RB2 & RB3)) [COLOR=Red]{[/COLOR]
//DelayMs(30);
[COLOR=Red]}[/COLOR] else [COLOR=Red]{[/COLOR]
RB4 = 0;
RB5 = 0;
RB6 = 0;
RB7 = 0;
}
}