© Sridhar Anandakrishnan 2018
Sridhar AnandakrishnanPropeller Programminghttps://doi.org/10.1007/978-1-4842-3354-2_16

16. Using Inline Assembly Instructions in C Code

Sridhar Anandakrishnan1 
(1)
Department of Geosciences, University Park, Pennsylvania, USA
 

Let’s now look at using PASM and C in the same stretch of code using a technique called inline assembly. You can use this when you require the fastest possible execution of a small section of repeated code. The main part of the code remains in C, but the critical section is written in PASM. In Figure 16-1, there is a drawing of the Antarctic Snow Cruiser: a hybrid exploration vehicle that was ahead of its times.

In this example, we will read the input pin MISO 32 times and shift the value into a ...

Get Propeller Programming: Using Assembler, Spin, and C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.