emailing-files-is-still-better / Ir-Blinky

PIC IR blinker for simple raw data
2 stars 1 forks source link

Very slow pin state changes #4

Closed georgev93 closed 1 year ago

georgev93 commented 1 year ago

digitalWrite sucks. According to This guy it takes 3.4 us. Just writing to the register only takes 0.19 us. Therefore, you could use the following macros instead of digitalWrite:

#define LED_ON    PORTB = B00000100
#define LED_OFF   PORTB = B00000000
georgev93 commented 1 year ago

Then later in the code you could call it with LED_ON; and LED_OFF; Not 100% sure that pin 10 is bit 2 in PORTB though... that might require verification

georgev93 commented 1 year ago

OH. And if you're going to update that, be sure to replace pinUpdateTime_us in the code with the right delay time

georgev93 commented 1 year ago

Speaking of closing issues... I think we're way past this now (buhbye Arduino)