Herunterladen Inhalt Inhalt Diese Seite drucken

JÄGER ADwin-light-16 Handbuch Seite 149

Inhaltsverzeichnis

Werbung

ADwin
Beispiel
#Include
ADwL16.inc
Rem SPI settings
#Define
data_order
#Define
mode
3
#Define
bits
8
#Define
clock
7
Init:
Rem Disable slave select via TTL high on pin DIGOUT-1
Set_Digout(0)
SPI_Enable(1)
SPI_Config(data_order, mode, bits, clock)
Par_1
=
10
Event:
SPI_Set_MOSI(Par_1)
Rem To select a slave you have to send the signal „Slave
Rem select" to the SPI slave. Connect a free DIO output to
Rem the slave SPI input and set the required TTL output level
Rem with the appropriate standard DIO instruction.
Rem Start slave select via TTL low on pin DIGOUT-1
Clear_Digout(0)
SPI_Start()
SPI_Wait()
Set_Digout(0)
Par_2
= SPI_Get_MISO()
ADwin-light-16 , Handbuch Version 3.5, November 2013
0
'MSB first
'CPOL = 1, CPHA = 1
'number of data bits
'clock rate: 78.125 kHz
'enable ADwin I/O Connector pins
'first data value
'set data value to be sent
'start data transfer
'wait until end of data transfer
'end slave select
'read received data value
SPI-Schnittstelle
SPI_Config
143

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis