PIC18F4550- PINGUINO

Photo of author

By Jackson Taylor

SIMULATION IN PROTEUS


LED BLINKING
void setup()
{
    // initialize the digital pin USERLED as an output.
    pinMode(USERLED, OUTPUT);  
}
void loop()
{
    digitalWrite(USERLED, HIGH);
    delay(50);     // wait for 50ms
    digitalWrite(USERLED, LOW);
    delay(50);     // wait for 50ms
}
PWM
void setup()
{
    pinMode(12, OUTPUT);
}
void loop()
{
analogWrite(12,100);
    delay(20);     // wait for 50ms
analogWrite(12,255);
    delay(20);     // wait for 50ms
analogWrite(12,512);
    delay(20);     // wait for 50ms
}
LCD
void setup()
{
//LCDPINS—– RS -PIN5 E -PIN4 D4 -PIN3 D5 -PIN2 D6 -PIN1 D7 -PIN0
lcd.pins(5, 4, 3, 2, 1, 0, 0, 0, 0, 0); // RS, E, D4 ~ D8
lcd.begin(16, 2); // set up the LCD’s number of columns and rows:
lcd.clear();//CLEAR DATA IN LCD
lcd.print(“Hello, World!”); // Print a message to the LCD.
lcd.setCursor(3, 1); //COLUMN NO.,RAW NO.
lcd.print(“EMERGING “); // Print a message to the LCD.
lcd.write(‘a’); //single char
int a=12;
lcd.printf(“%d”,a);
//lcd.noDisplay(); // Turn off the display:
//lcd.display(); // Turn on the display:
}
void loop()
{
}

See also
BLINKING - 8051