how_to_mix_c_and_asm
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| how_to_mix_c_and_asm [2007/04/07 02:47] – Added form link for included ASM (not inline ASM) stryd_one | how_to_mix_c_and_asm [2008/09/29 12:27] (current) – wackazong | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| You might have to declare some additional variables, but the concept is quite straightforward. | You might have to declare some additional variables, but the concept is quite straightforward. | ||
| + | Do not forget to include the header file of your processor from the SDCC header files, or variables like PRODL will not be defined: e.g. #include < | ||
| <code c> | <code c> | ||
| - | unsigned char Scale_7bit(unsigned char evnt2, unsigned char min, unsigned char max) | + | unsigned char Scale_7bit(unsigned char evnt2, unsigned char min, unsigned char max) { |
| - | { | + | |
| // scaled value is (<8-bit random> * ) >> 8 | // scaled value is (<8-bit random> * ) >> 8 | ||
| PRODL = evnt2 << 1; // 8bit value | PRODL = evnt2 << 1; // 8bit value | ||
how_to_mix_c_and_asm.1175914038.txt.gz · Last modified: 2008/09/10 17:31 (external edit)
