MikroElektronika PIC Microcontrollers PIC16 Manuel d'utilisateur Page 164

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 172
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 163
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
The folowing code demonstrates how to use SPI library procedures and functions.
Same example along with m7219.pbas file is given in folder ../mikroBasic/exam-
ples. Assumed HW configuration is: max7219 (chip select pin) is connected to
RC1, and SDO, SDI, SCK pins are connected to corresponding pins of max7219.
program SPI
include "m7219.pbas"
dim i as byte
main:
SPI_init
' standard configuration
TRISC = TRISC and $Fd
max7219_init
' initialize max7219
PORTC.1 = 0
' select max7219
SPI_write(1)
' send address (1) to max7219
SPI_write(7)
' send data (7) to max7219
PORTC.1 = 0
' deselect max7219s
end.
MikroElektronika:
Development
tools
-
Books
-
Compilers
mikroBASIC
making it simple...
159
page
Example
Vue de la page 163

Commentaires sur ces manuels

Pas de commentaire