kranenborg
Senior Member
M2 chips: Can Serial Out pin be overridden to become a DAC Vref- input?
Hello,
The M2 series has a large number of very useful modules (comparators, Data Signal Modulator, etc.) which, although not directly supported by Basic commands like on the X2 series (I presume because the M2 series have less memory than the X2 series to contain the Basic Interpreter and thus the supported set of Basic commands must be smaller), nevertheless can be made fully accessible through appropriate POKESFR commands (see for example my contribution regarding the use of the on-chip comparators: http://www.picaxeforum.co.uk/showthread.php?17654-Use-of-Comparators-in-the-PICAXE-18M2 ). Hippy has done something similar with the DSM.
One module that has my particular interest (and in principle supported by the DACSETUP command) is the DAC module. With reference to the corresponding Microchip datasheets it becomes clear that principally the on-chip DAC module should allow to have both the Vref- and Vref+ as external inputs (not for the 8-pin device, but indeed for the 14, 18 and 20 pin versions, and the 14M2 is exactly what I need). However the DACSETUP and ADCSETUP command descriptions in the Picaxe manual state that you cannot have both Vref+ and Vref- available at the same time for any of the M2 chips. Some further study of the mapping of the Picaxe functions on the PIC chips shows why: the Serial Out pin is always mapped on either Vref+ or Vref-. This means that this pin is always considered an output and the Programming Editor consequently blocks any INPUT command on these pins.
However I have not given up hope yet: a LET DIRSB = %00000000 command for a 14M2 application is accepted by the PE (implying the Serial Output pin B0 would be an input if executed accordingly). My questions then are: 1: would indeed this command override the Serial Output and make it an input pin (in casu an analog Vref- input) and 2: do I need to execute a DISCONNECT command as well?
Thanks, Jurjen
http://www.kranenborg.org/electronics
Hello,
The M2 series has a large number of very useful modules (comparators, Data Signal Modulator, etc.) which, although not directly supported by Basic commands like on the X2 series (I presume because the M2 series have less memory than the X2 series to contain the Basic Interpreter and thus the supported set of Basic commands must be smaller), nevertheless can be made fully accessible through appropriate POKESFR commands (see for example my contribution regarding the use of the on-chip comparators: http://www.picaxeforum.co.uk/showthread.php?17654-Use-of-Comparators-in-the-PICAXE-18M2 ). Hippy has done something similar with the DSM.
One module that has my particular interest (and in principle supported by the DACSETUP command) is the DAC module. With reference to the corresponding Microchip datasheets it becomes clear that principally the on-chip DAC module should allow to have both the Vref- and Vref+ as external inputs (not for the 8-pin device, but indeed for the 14, 18 and 20 pin versions, and the 14M2 is exactly what I need). However the DACSETUP and ADCSETUP command descriptions in the Picaxe manual state that you cannot have both Vref+ and Vref- available at the same time for any of the M2 chips. Some further study of the mapping of the Picaxe functions on the PIC chips shows why: the Serial Out pin is always mapped on either Vref+ or Vref-. This means that this pin is always considered an output and the Programming Editor consequently blocks any INPUT command on these pins.
However I have not given up hope yet: a LET DIRSB = %00000000 command for a 14M2 application is accepted by the PE (implying the Serial Output pin B0 would be an input if executed accordingly). My questions then are: 1: would indeed this command override the Serial Output and make it an input pin (in casu an analog Vref- input) and 2: do I need to execute a DISCONNECT command as well?
Thanks, Jurjen
http://www.kranenborg.org/electronics
Last edited: