MikroElektronika PIC Microcontrollers PIC16 Manual de usuario Pagina 164

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 172
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 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
Vista de pagina 163

Comentarios a estos manuales

Sin comentarios