Presentation is loading. Please wait.

Presentation is loading. Please wait.

Vervolg C Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1 Onderwerpen voor vandaag Dallas one-wire interface Opgave:

Similar presentations


Presentation on theme: "Vervolg C Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1 Onderwerpen voor vandaag Dallas one-wire interface Opgave:"— Presentation transcript:

1 vervolg C Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1 Onderwerpen voor vandaag Dallas one-wire interface Opgave: lees een 1-wire ‘Identity-Button’ uit Hoezo 1 wire?

2 vervolg C Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 2 1-wire device intern

3 vervolg C Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 3 1-wire bus

4 vervolg C Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 4 Reset, presence pulse

5 vervolg C Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 5 Write

6 vervolg C Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 6 Read

7 vervolg C Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 7 DS1990A protocol D1W_Reset(); D1W_Send( 0x33 ); for( i =0; i < 8; i++ ){ … = D1W_Receive(); }

8 vervolg C Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 8 Dallas.zip #define PI_D1W 5 void D1W_Set( int x ){ if( x ){ ARK_GPIO_direction( PIN_D1W, ARK_GPIO_INPUT ); } else { ARK_GPIO_write( PIN_D1W, 0 ); ARK_GPIO_direction( PIN_D1W, ARK_GPIO_OUTPUT ); } int D1W_Get( void ){ return ARK_GPIO_read( PIN_D1W ); } void _D1W_Init( void ){ D1W_Set( 1 ); }

9 vervolg C Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 9 Dallas.zip int D1W_Present( void ){ int present; D1W_Set( 0 ); ARK_wait_us( 600 ); D1W_Set( 1 ); ARK_wait_us( 72 ); present = ! D1W_Get(); ARK_wait_us( 600 ); return present && D1W_Get(); }

10 vervolg C Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 10 Dallas.zip unsigned char D1W_Receive( void ){ unsigned char x; int i; for( i = 0; i < 8; i++ ){ x = x >> 1; D1W_Set( 0 ); ARK_wait_us( 5 ); D1W_Set( 1 ); ARK_wait_us( 5 ); if( D1W_Get()){ x = x | 0x80; } ARK_wait_us( 100 ); } return x; }

11 vervolg C Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 11 Dallas.zip void D1W_Send( unsigned char x ){ } int main(){ }

12 vervolg C Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 12 Opdracht Gebruik dallas.zip. Maak het programma af, zodat als er een ID button wordt aangesloten, hiervan het serienummer wordt getoond op de LCD. Als er geen button is aangesloten moet dat ook worden aangegeven.


Download ppt "Vervolg C Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1 Onderwerpen voor vandaag Dallas one-wire interface Opgave:"

Similar presentations


Ads by Google