On more common languages like C or Java thing are much better.
Also on Arduino (which is C basically) gives a working piece of code most of the times.
All depends on the prompt of course.
Ioannis
On more common languages like C or Java thing are much better.
Also on Arduino (which is C basically) gives a working piece of code most of the times.
All depends on the prompt of course.
Ioannis
Yes, correct.
I have seen that with my own eyes - student asked to write a frequency meter code for arduino, she only specified that 4 digit, 7 segment display module was connected to the specified pins, and also specified a pin used as input - generated code worked directly and correctly, no modifications were needed. Both frequency measurement code, display multiplexing code - all were generated by AI.
Well, I tried that code and even after fixing syntax, it does not work.
By the way, I tried to do my own code for that chip, but that also does not work - returns 64 for MSB and LSB bytes. The hardware wiring is correct, because if I remove VDD to chip, these bytes are returned as 0.
Here's my code for it, according to chip datasheet:
1. Write to Config register:
First byte: 0b10010000 (first 7-bit I2C address followed by a low R/W bit)
Second byte: 0b00000001 (points to Config register)
Third byte: 0b10000100 (MSB of the Config register to be written)
Fourth byte: 0b10000011 (LSB of the Config register to be written)
2. Write to Address Pointer register:
First byte: 0b10010000 (first 7-bit I2C address followed by a low R/W bit)
Second byte: 0b00000000 (points to Conversion register)
3. Read Conversion register:
First byte: 0b10010001 (first 7-bit I2C address followed by a high R/W bit)
Second byte: the ADS111x response with the MSB of the Conversion register
Third byte: the ADS111x response with the LSB of the Conversion register
Code:DO i2cwrite i2dta, i2clk, $48,$01,[132,131] 'write config pause 10 i2cwrite i2dta, i2clk, $48,$0 'convert pause 10 i2cread i2dta, i2clk, $48,[data1,data2] 'read data serout2 portc.5,90, ["adc=",dec data1, dec data2,13,10] LOOP
What is the purpose of this line?
i2cwrite i2dta, i2clk, $48,$0 'convert
Ioannis
I understand this as "start conversion(measurement)"
As said in 2. of quote from the datasheet.
are we still talking about a ds3231 ?
if so then if chat gpt leads you to this there something terribly wrong
this is incorrect on so many levels starting with device address, conversion time and virtually every thing from there onDO
i2cwrite i2dta, i2clk, $48,$01,[132,131] 'write config
pause 10
i2cwrite i2dta, i2clk, $48,$0 'convert
pause 10
i2cread i2dta, i2clk, $48,[data1,data2] 'read data
serout2 portc.5,90, ["adc=",dec data1, dec data2,13,10]
LOOP
Warning I'm not a teacher
No, this is ADS1115, as mentioned in comments in above post.
Bookmarks