ADC inputs yet again
Posted: Tue Apr 14, 2009 3:52 pm
It has been some months since I last picked up a new copy of the block-set, and the latest
version seems to have broken something which once worked.
The default behaviour seems to be to leave all analogue input pins configured for
analogue input. Explicitly putting a digital I/O block in a model would set bits in the
AD[12]PCFG[HL] registers to disable them as analogue inputs. In the past, I have
used digital input blocks driving terminator blocks. to ensure that I could use the
associated pin as a digital I/O pin (in code not visible in the Simulink model diagram).
This no longer works.
The analogue pins I am using are all in AN16-31 (so they are configured
in AD1PCFGH). The list is [ 16 17 18 19 20 22 23 24 25 26 ].
I am using AN27-AN31 as digital inputs. Whereas AD1PCFGH used
to be set (correctly) to 0xF800, it is now left as 0 (the default state
at start-up).
There has been some change in this area: in fact, I used to see compiler
warnings about 16-bit shifts on 16-bit quantities.
version seems to have broken something which once worked.
The default behaviour seems to be to leave all analogue input pins configured for
analogue input. Explicitly putting a digital I/O block in a model would set bits in the
AD[12]PCFG[HL] registers to disable them as analogue inputs. In the past, I have
used digital input blocks driving terminator blocks. to ensure that I could use the
associated pin as a digital I/O pin (in code not visible in the Simulink model diagram).
This no longer works.
The analogue pins I am using are all in AN16-31 (so they are configured
in AD1PCFGH). The list is [ 16 17 18 19 20 22 23 24 25 26 ].
I am using AN27-AN31 as digital inputs. Whereas AD1PCFGH used
to be set (correctly) to 0xF800, it is now left as 0 (the default state
at start-up).
There has been some change in this area: in fact, I used to see compiler
warnings about 16-bit shifts on 16-bit quantities.