Hi Simon
Thanks for the quick response!
I've been investigating further as has Nick Ager (across the other side of London). Initially it didn't look as though he could reproduce it but now I think he has.
What I've done is to to modify the "AnalogIn reading 16-bit samples" example to only display values above 0x100 as follows:
...
for(int i=0; i<1024; i++) {
if (samples[i] > 0x100)
printf("%d, 0x%04X\n", i, samples[i]);
...
I then tried shorting p20 directly to ground as shown:
Running the program doesn't show up any values above 0x100 on the 10 or so runs I tried.
I then added a single jumper to the analog input line with the free end dangling in space! - as shown:
Amazingly running the program sometimes results in one or small number of values above 0x100:
Results:
2, 0x1DA1
104, 0xFFEF
840, 0x88D8
Then I modified it again slightly and use two jumpers with the middle of the two connected together by another part of the breadboard - I've tried this in lots of other ways with similar results:
This gives several values above 0x100 each time I run the program:
Results:
68, 0x0420
204, 0xFFDF
516, 0xFCFF
528, 0x3273
880, 0x2872
884, 0x8CF8
1012, 0x4244
Results:
236, 0xFFFF
628, 0x4784
788, 0x7FD7
Results:
164, 0x0410
284, 0x3ED3
536, 0xFFFF
584, 0x1801
928, 0x6E76
Results:
8, 0xA08A
124, 0x40C4
128, 0xFFFF
240, 0xFFFF
364, 0xAD8A
412, 0x0400
424, 0x01C0
468, 0x2062
644, 0xF35F
712, 0x0C80
784, 0x7FF7
816, 0x7EF7
856, 0xCFFC
892, 0x0800
904, 0xBFDB
948, 0xA6FA
988, 0xCEEC
Please let me know if I can provide other info.
Regards
Rob
I've noticed a problem with AnalogIn giving values of 1.0 (or 0xFFFF) spuriously - and other invalid values - even though the pin in question is held at a fixed DC value (e.g. 0V but I've also tried other DC levels).
If I run the middle example in AnalogIn Examples section from the Handbook - the one with "AnalogIn reading 16-bit samples" in the opening comment then I see:
....
197, 0x0000
198, 0x0000
199, 0x0000
200, 0xFFFF
201, 0x0000
202, 0x0000
....
282, 0x0000
283, 0x0000
284, 0x0000
285, 0xFFFF
286, 0x0000
287, 0x0000
288, 0x0000
289, 0x0000
....
Is this a hardware fault with my board (I've tried on p15 and p20 so far with the same spurious results)?