1-Wire_Master

smallcracker 2021-03-02 00:00:00
Categories: Tags:

简介

例程

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
SysCtlPeripheralEnable(SYSCTL_PERIPH_ONEWIRE0);
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_ONEWIRE0)){}
//
// Initialize the module to use standard speed and read distance.
//
OneWireInit(ONEWIRE0_BASE, (ONEWIRE_INIT_READ_STD | ONEWIRE_INIT_SPD_STD));
//
// Clear any pending interrupts.
//
OneWireIntClear(ONEWIRE0_BASE, (ONEWIRE_INT_STUCK | ONEWIRE_INT_NO_SLAVE |ONEWIRE_INT_RESET_DONE |ONEWIRE_INT_OP_DONE));
//
// Enable the interrupts for operation done and the stuck bus error
// condition.
//
OneWireIntEnable(ONEWIRE0_BASE, (ONEWIRE_INT_OP_DONE |
ONEWIRE_INT_BUS_STUCK));
IntEnable(INT_ONEWIRE0);
//
// Setup a four byte sequence and a bit count.
//
ulData = ((0x01 << 24) | (0x12 << 16) | (0x10 << 8) | 0xcc;
ulBitCount = sizeof(ulData) * 8;
//
// Initiate a Reset and Write operation on the 1-Wire bus.
//
OneWireTransaction(ONEWIRE0_BASE, (ONEWIRE_OP_RESET | ONEWIRE_OP_WRITE),ulData, ulBitCount);