Dear Friends
;
Bellow is the GOSUB (500-700) code that emulates SPI communication thru native COM port to MAXIM186 ADC 8ch 12bit analog converter IC . It was writed for the old QB45/QB71 and desktop PC ...
I was mind if is possible this code works with USB COM ports of W10 notebooks...
Any adaption or suggestion how emulate SPI or I2C communications ?
Thanks for your comments
120 FOR N
= 0 TO 7:
REM *****AQUI SELECIONA O NUMERO DE CANAIS
******* 130 SEL
= 7 - (N \
2) - 4 * (N
AND 1)
500 REM *************Aquisita canais MAX186
****** 510 CMD = 128 + 16 * SEL + 8 + 4 + 2
520 BIT = 128
560 OUT (BA
+ 4), RTS
+ 1 580 BIT = BIT \ 2
610 BIT = 2048: AUS = 0
670 BIT = BIT \ 2
692 V(N + 1) = AUS / 1000
bellow is a I2C code of BasicStamp to read CH0 of MAX186
control is over 4 pins:
CS
DIN
DOUT
SCLK
read1: 'le canal 0 e armazena na variavel AD(0): read ch 0 and store as variable AD(0)
low CS 'bring CS low
shiftout din,sclk,1,[%10001111] 'send the init string ' the high nibble is the channel number
shiftin dout,sclk,2,[AD(0)\12] 'get the 12 bit result
high CS 'bring CS high