Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Wow my hello world 16f18446 got 21 downloads

Status
Not open for further replies.
Interesting... I had problems with a 16F15325 I2C OLED demo (XC8) which sound similar to the problems you describe. I never did get the default I2C pins working and used another pair instead. Also, while the Datasheet and MCC generated files suggested I could test for completed I2C operations using only the MSSP interrupt flag, I couldn't get I2C working without also testing some other flags (S and P, IIRC) before testing the interrupt flag.

I did upgrade to XC8 v2.0 so I should probably test this again... Let me know if you'd like to see my 16F15325 I2C OLED program?
 
Last edited:
I did upgrade to XC8 v2.0 so I should probably test this again... Let me know if you'd like to see my 16F15325 I2C OLED program?

Worth a try with V2.0, I've just recently converted the AdaFruit OLED library to XC8, had it running on an 18F so far - although I've got a bit of a strange anomaly in one of the graphic demos, the filled rectangle one. Using the for/next loop in the demo one of the rectangles is taller than it should be - if I rewrite the demo as a linear series of instructions, with constants for the dimensions, it works fine?.

Code:
void testfillrect(void) 
{
  unsigned int color = SSD_WHITE;
  ssd1306_clearDisplay();
  for (unsigned int i=0; i<HEIGHT/2; i+=3) 
  {
    // alternate colours
    ADA_FillRect(i, i, WIDTH-i*2, HEIGHT-i*2, color);
    ssd1306_display();
    Delay_ms(3000);
    if (color==SSD_WHITE)
        color = SSD_BLACK;
    else
        color = SSD_WHITE;
    
  }
}

Incidentally, the plan is to potentially use it with the 16F18446, to that end I added a four pin I2C extesion socket to my PCB.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top