SetDigitalIO

SwordfishUser.SetDigitalIO History

Hide minor edits - Show changes to output

Changed line 2 from:
[[Attach:SetDigitalIO_v23.zip | Download Set Digital IO Library 2.3]] \\
to:
[[Attach:SetDigitalIO_v24.zip | Download Set Digital IO Library 2.4]] \\
Added lines 42-44:

Version 2.4 changes:
  - add support for 18FxxQ10 devices
Changed line 15 from:
In addition to the original SetAllDigital() routine there is now a corresponding SetAllAnalog(), and a SetAnalogPort() routine that will let you change a single pin mode from digital<->analog. These routines vary with device so you'll have to check the source for how to specify your pins.
to:
In addition to the original SetAllDigital() routine there is now a corresponding SetAllAnalog(), and a SetAnalogPort() routine that will let you change a single pin mode from digital<->analog. Pin names typically follow the 'ANx' names in the datasheet, but these vary with device so you'll have to check the source for how to specify your pins.
Added lines 34-41:

NOTE: SetAnalogPort() relies on being able to change the mode for an individual pin, and some older devices don't allow you to do that... you have to set them in groups. If you get a "warning - unknown analog select map" then you're out of luck using the function.
SetAnalogPort() can be disabled by adding the following #option before including the module
=code [=
#option DigitalIO_AnalogPort = false      // disable SetAnalogPort
include "setdigitalio.bas"
=]

Added lines 14-33:

In addition to the original SetAllDigital() routine there is now a corresponding SetAllAnalog(), and a SetAnalogPort() routine that will let you change a single pin mode from digital<->analog. These routines vary with device so you'll have to check the source for how to specify your pins.


Example usage:
=code [=
device = 18F26K22
include "setdigitalio.bas"

// set all pins to digital
SetAllDigital()

// example 2 - set all pins to digital and then change AN3 to analog
SetAllDigital()
SetAnalogPort(AN3, ANA)    // AN3 is PORTA.3 in the 26K22

// example 3 - set all pins to analog and then change AN3 to digital
SetAllAnalog()
SetAnalogPort(AN3, DIG)    // AN3 is PORTA.3 in the 26K22
=]
Changed line 2 from:
[[Attach:SetDigitalIO_v22.zip | Download Set Digital IO Library 2.2]] \\
to:
[[Attach:SetDigitalIO_v23.zip | Download Set Digital IO Library 2.3]] \\
Added lines 14-17:

Version 2.3 changes:
  - add support for 18LFxxK50 devices
  - add missing 18LF4xK22 to analog pin definitions
Changed line 2 from:
[[Attach:SetDigitalIO_v21.zip | Download Set Digital IO Library 2.1]] \\
to:
[[Attach:SetDigitalIO_v22.zip | Download Set Digital IO Library 2.2]] \\
Added lines 14-16:

Version 2.2 changes:
  - add support for 18LF devices
Changed line 2 from:
[[Attach:SetDigitalIO.zip | Download Set Digital IO Library 2.1]] \\
to:
[[Attach:SetDigitalIO_v21.zip | Download Set Digital IO Library 2.1]] \\
Changed line 2 from:
[[Attach:SetDigitalIO.zip | Download Set Digital IO Library 1.8]] \\
to:
[[Attach:SetDigitalIO.zip | Download Set Digital IO Library 2.1]] \\
Added lines 14-17:

Version 2.1 changes:
  - add support for 18FxxK40 family
  - add SetAnalogPort() functions
Changed line 2 from:
[[Attach:SetDigitalIO.zip | Download Set Digital IO Library 1.7]] \\
to:
[[Attach:SetDigitalIO.zip | Download Set Digital IO Library 1.8]] \\
Added lines 14-17:

Version 1.8 changes:
  - add slew-rate control SLRCON settings for K series devices and set default to standard rate
  - add #option DigitalIO_SLEWRATE to change default
Added lines 20-21:

Also, the Swordfish "utils.bas" library now hooks into this library. Simply copy any updated SetDigitalIO.bas file into the library or userlibrary folder will now keep "utils.bas" up to date.
Changed line 2 from:
[[Attach:SetDigitalIO.zip | Download Set Digital IO Library 1.6]] \\
to:
[[Attach:SetDigitalIO.zip | Download Set Digital IO Library 1.7]] \\
Deleted line 9:
Deleted line 12:
Added lines 15-19:
Version 1.7 changes:
  - add 18F2xK50/4xK50
  - add J94/J99 series
  - add check for _IsCompilerSE define
  - move ADSHR definition since not all devices have WDTCON
Changed line 2 from:
[[http://www.sfcompiler.co.uk/wiki/wiki-uploads/Profiles/JerryMessina/setdigitalio.zip | Download Set Digital IO Library 1.6]] \\
to:
[[Attach:SetDigitalIO.zip | Download Set Digital IO Library 1.6]] \\
Changed line 15 from:
either in this file or before including it. I did this as a separate module, but you could always incorporate it into utils.bas (where the current one resides). If you have any comments, please posts [[http://www.sfcompiler.co.uk/forum/viewtopic.php?t=1481 | here]].
to:
either in this file or before including it. I did this as a separate module, but you could always incorporate it into utils.bas (where the current one resides). If you have any comments, please post them [[http://sfcompiler.co.uk/phpBB3/viewtopic.php?f=4&t=1481 | here]]. You may also want to check that thread for any updates/fixes.
August 21, 2011, at 07:46 PM by David Barker -
Changed lines 15-19 from:
either in this file or before including it.

I
did this as a separate module, but you could always incorporate it into utils.bas (where the current one resides). 

to:
either in this file or before including it. I did this as a separate module, but you could always incorporate it into utils.bas (where the current one resides). If you have any comments, please posts [[http://www.sfcompiler.co.uk/forum/viewtopic.php?t=1481 | here]].

August 21, 2011, at 07:45 PM by David Barker -
Changed line 2 from:
[[http://www.sfcompiler.co.uk/wiki/wiki-uploads/Profiles/JerryMessina/setdigitalio.zip | Download Set Digital IO Library]] \\
to:
[[http://www.sfcompiler.co.uk/wiki/wiki-uploads/Profiles/JerryMessina/setdigitalio.zip | Download Set Digital IO Library 1.6]] \\
Changed lines 9-13 from:
There are two new macros... read_sfr() and write_sfr() that should allow this to work with the SE compiler even for registers that are located outside of Bank 0. If you're using the SE compiler, set '#option SWORDFISH_SE = true', either in this file or before including it.

I did this as a separate module, but you could always incorporate it into utils.bas (where the current one resides)

to:
There are two new macros... read_sfr() and write_sfr() that should allow this to work with the SE compiler even for registers that are located outside of Bank 0. If you're using the SE compiler, set

=code [=
#option SWORDFISH_SE = true
=]

either
in this file or before including it.

I did this as a separate module, but you could always incorporate it into utils.bas (where the current one resides).

August 21, 2011, at 07:43 PM by David Barker -
Added lines 1-13:
%lfloat text-align=center % http://www.sfcompiler.co.uk/wiki/uploads/icons/download-48x48.png
[[http://www.sfcompiler.co.uk/wiki/wiki-uploads/Profiles/JerryMessina/setdigitalio.zip | Download Set Digital IO Library]] \\
setdigitalio.zip

!!! Overview

Here's an updated version of SetAllDigital() with support for many of the J and K series parts and the SE compiler. I tried to cover some of the odd-ball ones like those that have non-access bank registers and parts that have shared overlaying register addresses, but the list is far from complete. I didn't really change the standard F series parts.

There are two new macros... read_sfr() and write_sfr() that should allow this to work with the SE compiler even for registers that are located outside of Bank 0. If you're using the SE compiler, set '#option SWORDFISH_SE = true', either in this file or before including it.

I did this as a separate module, but you could always incorporate it into utils.bas (where the current one resides)

August 21, 2011, at 07:41 PM by David Barker -