chipKIT-core 1.4.0 Now with Non-blocking analogRead() By: Jacob Christ

Blocking vs Non-Blocking Functions • A blocking function ties up CPU until the requested task is complete. • Usually this means lots of wasted CPU cycles

• A non-blocking function, when called, returns a value that lets the calling program know if the requested task has completed. • If the task is complete then we can act on the results

Performance (best case) chipKIT Board

PIC23

Clock Freq

loop() Frequency Blocking Analog Read

loop() Frequency Non-Blocking Analog Read

Improvement

Lenny

MX

40MHz

49.14 kHz

127.39 kHz

2.59

FubranioSD

MX

80MHz

90.91 kHz

217.39 kHz

2.39

WiFire

MZEFG

200MHz

233.10 kHz

1162.79 kHz

4.98

Performance (best case) chipKIT Board

PIC23

Clock Freq

loop() Frequency Blocking Analog Read

loop() Frequency Non-Blocking Analog Read

Improvement

Lenny

MX

40MHz

49.14 kHz

127.39 kHz

2.59

FubranioSD

MX

80MHz

90.91 kHz

217.39 kHz

2.39

WiFire

MZEFG

200MHz

233.10 kHz

1162.79 kHz

4.98

• 80MHz PIC32 loop() with non-blocking reads almost as fast as 200MHz PIC32 loop() with blocking reads. • What can you do with, 1.162MHz loop() speed • How about running 20 50kHz PID loops?

How does the code change?

Arduino style blocking AnalogRead #define ADC_TEST_PIN 16

void setup() { } void loop() { uint32_t value; value = analogRead(ADC_TEST_PIN); }

chipKIT-core style non-blocking AnalogRead #define ADC_TEST_PIN 16 void setup() { analogReadConversionStart(ADC_TEST_PIN); } void loop() { uint32_t value; if ( analogReadConversionComplete() ) { value = analogReadConversion(); analogReadConversionStart(ADC_TEST_PIN); } }

And one more thing… blocking reads still work in chipKIT-core too.

WARNING! • Don’t mix non-blocking and blocking analogRead’s unless you understand how the code works under the hood. • Doing so incorrectly could cause your board to hang.

Why not to mix blocking/non-blocking • analogRead() is really just using the new non-blocking calls • The non-blocking calls keep track of the currently converting channel in global variable. • If you attempt to start a conversion on one channel and wait for it to complete on another you may get bad juju. • The blocking analogRead() now looks like this: int analogRead(uint8_t pin) { analogReadConversionStart(pin); while( ! analogReadConversionComplete() ); return analogReadConversion(); }

Find out more: • http://chipkit32.github.io/chipKIT-core/api_analogread_non_blocking • https://github.com/chipKIT32/chipKIT-core

• http://chipKIT.net • mailto:[email protected]

chipKIT-core 1.4.0 -

Find out more: • http://chipkit32.github.io/chipKIT-core/api_analogread_non_blocking · • https://github.com/chipKIT32/chipKIT-core · • http://chipKIT.net.

663KB Sizes 4 Downloads 146 Views

Recommend Documents

Cacciatora ​140:- Napolitana ​130:- Capricciosa ​140
tomato, cheese, fresh grilled zucchini, eggplants and bell peppers with marinated artichokes and black olives. Creazione di Adamo ​179:- tomato, cheese ...

140 - Murya Habbash.pdf
analysis also shows that dual role, firm complexity, firm size, firm age, and state ownership are. positive determinants of RD, while firm leverage the only ...

Schaper 140.pdf
Page 1 of 17. Developments in the Australian Small Business Sector Since 1970. Michael T. Schaper, Ph.D. Adjunct Professor, School of Management, Curtin University. GPO Box U 1987, Perth, Western Australia 6845. Phone: +61 (0)423 731 311 Email: Micha

140 08 article.pmd
and 329m3 during NEM season of 2002 and 2003 respectively. CO l maize was sown in first fortnight of October in 2002 and second fortnight of. September in 2003. Seed rate of 20 kg ha-1 with a spacing of 45 x 20cm for maize cowpea var. CO5 and sun hem

man-140\tamilhotwoman.pdf
duplicate the documents Tamilhotwoman to your workplace computer system or in the house as. well as in your laptop computer. Simply share this excellent information to others. Recommend. them to visit this page as well as get their hunted for books T

Paginas 140.pdf
típicamente europea (aunque existen algunas citas de Turquía y Marruecos) (Baz, 2003). Distribución: Esta especie se ha encontrado en la Cueva Secreta del ...

Paginas 140.pdf
Prionoglaris stygia Enderlein, 1909 y Psyllipsocus ramburi Selys-Longschamps, 1872. ARTHROPODA, HEXAPODA, INSECTA, PSOCOPTERA. FAMILIA PRIONOGLARIDIDAE. Prionoglaris stygia Enderlein, 1909. Descripción: Especie troglófila y muy común en cavidades

man-140\kerala-pundai-images.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item.

man-140\tamil-housewife-pundai.pdf
DOWNLOAD EBOOK PDF FROM OUR ONLINE LIBRARY. Page 2 of 5. Page 3 of 5. LIST EBOOK RELATED TO TAMIL HOUSEWIFE PUNDAI PDF. 1. PDF Ebook : Tamil Housewife. 2. PDF Ebook : Tamil Housewife ... PDF Ebook : Tamil Pundai Software. 24. PDF Ebook : Tamil Kama P

Canvi d'aires n. 140.pdf
Els petits, els joves... i les mares. 11 de febrer, Mare de Déu de Lourdes. Page 2 of 2. Canvi d'aires n. 140.pdf. Canvi d'aires n. 140.pdf. Open. Extract. Open with.

man-140\motorcycle-workshop-design.pdf
Connect more apps... Try one of the apps below to open or edit this item. man-140\motorcycle-workshop-design.pdf. man-140\motorcycle-workshop-design.pdf.

Math 140 (FA10) Syllabus.pdf
MATH 140 ASSOCIATE DEGREE OUTCOMES: (DETAILS ON JCC ACADEMIC DEAN WEBPAGE). ADO 3. Demonstrate computational skills and mathematical ...

man-140\antrvasna-new-story.pdf
File name : antrvasna new story.pdf ... Antrvasna New Story When many people are busy to look for fro in the book store, you are really ... DOWNLOAD EBOOK PDF FROM OUR ONLINE LIBRARY ... PDF Ebook : Ee Ea Y Ey Ei Ie Story.

icrj-10-140.pdf
Page 1 of 3. Int Cardiovasc Res J.2016;10(3):140-142.icrj.26147. Filippo Maria Cauti 1, 2, Andrea Radinovic 1, Patrizio Mazzone 1, *, Damiano Regazzoli 1, Fabrizio. Guarracini 1, Simone Sala 1, Marco Ancona 1, Nicola Trevisi 1, Paolo Della Bella 1. 1

man-140\nissan-maintenance-service.pdf
Connect more apps... Try one of the apps below to open or edit this item. man-140\nissan-maintenance-service.pdf. man-140\nissan-maintenance-service.pdf.

man-140\maverick-ormond-beach.pdf
Connect more apps... Try one of the apps below to open or edit this item. man-140\maverick-ormond-beach.pdf. man-140\maverick-ormond-beach.pdf. Open.

man-140\binatone-instructions-phone.pdf
Connect more apps... Try one of the apps below to open or edit this item. man-140\binatone-instructions-phone.pdf. man-140\binatone-instructions-phone.pdf.

starcraft-140-pro-troller.pdf
Whoops! There was a problem loading more pages. Retrying... Whoops! There was a problem previewing this document. Retrying... Download. Connect more ...

xr21v1410-140-010314-oqkmok.pdf
TX 9 O UART Channel A Transmit Data or IR Transmit Data. GPIO0/RI#/RWK# 8 I/O General purpose I/O or UART Ring-Indicator input (active low) or Remote.