Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20717

BASCOM Project Blog : Working with ADC128D818 12 bit ADC & system monitor : REPLY

$
0
0
Step two write to the registers: This code first reads the value in the interrupt mask register (0000_0000 default) then writes 1001_1001 to it then reads it again to see the value changed Note the reading of the register is for debug purposes not needed in final code. Regards Paul. [code:1:a6b93c381c] 'debug code I2cstart ' Generate start code write I2cwbyte &H3A ' send address write I2cwbyte &H03 ' register address in ADC128 see data sheet I2cstop 'stop buss ' Now start buss again and read the byte/s from register location previously sent I2cstart 'start buss I2cwbyte &H3B ' Generate start code read I2crbyte Adc128l , Ack 'for two bytes 'I2crbyte Adc128h , Nack 'get value from register I2cstop 'stop buss 'Print Bin(adc128h) Print "1>>" ; Bin(adc128l) 'show default '---------------------------------------- 'the wanted code I2cstart ' Generate start code write I2cwbyte &H3A ' send address write 'interrupt mask register I2cwbyte &H03 ' register address in ADC128 see data sheet I2cwbyte &B1001_1001 'write value to register I2cstop 'stop buss '-------------------------------------------- 'debug code I2cstart ' Generate start code write I2cwbyte &H3A ' send address write I2cwbyte &H03 ' register address in ADC128 see data sheet I2cstop 'stop buss ' Now start buss again and read the byte/s from register location previously sent I2cstart 'start buss I2cwbyte &H3B ' Generate start code read I2crbyte Adc128l , Ack 'for two bytes 'I2crbyte Adc128h , Nack 'get value from register I2cstop 'stop buss 'Print Bin(adc128h) Print "2>>>" ; Bin(adc128l) 'show new value [/code:1:a6b93c381c]

Viewing all articles
Browse latest Browse all 20717

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>