Shop OBEX P1 Docs P2 Docs Learn Events
PIN versus CON Declarations — Parallax Forums

PIN versus CON Declarations

playinmyblues_nsccplayinmyblues_nscc Posts: 38
edited 2013-01-12 10:23 in BASIC Stamp
Hi. I am working my way through the StampWorks book and have come across a small issue regarding the naming pins. In programs for experiments 11, 12, and 13 (and maybe others) there are declarations in the
I/O Definitions section. Here is an example from experiment 12 (framed by asterisks):

********************************************************
' -- I/O Definitions --

E PIN 1 ' Enable pin
RW PIN 2 ' Read/Write
RS CON 3 ' Register Select
LcdBus VAR OUTB ' 4-bit data bus
********************************************************

The whole program is inside a zip file downloaded under the "Downloads and Resources" section here: http://www.parallax.com/Store/Microcontrollers/BASICStampProgrammingKits/tabid/136/CategoryID/11/List/0/SortField/0/Level/a/ProductID/329/Default.aspx

When this program is run directly from the source code, it runs as it should. When the line dealing with I/O Pin 3 is named as a "PIN" instead of a "CON" as shown above, the program runs the same.

My question is why are I/O Pins 1 and 2 named as PINs whereas I/O Pin 3 is named a CON? Is it to demonstrate that either declaration will work or is there something that I have missed or not come across yet?

Just for reference, page 20 in the StampWorks book under the section called "4. Naming I/O Pins" provides information about the declaration and naming of I/O pins but nothing about naming the pins with the CON declaration. I also reviewed pages 99 - 102 in the Basic Stamp Syntax and Reference Manual about the use of the PIN declaration but did not find out why the difference above might occur.

Comments

  • Tracy AllenTracy Allen Posts: 6,662
    edited 2013-01-12 10:23
    I'm not sure why StampWorks did it that way, but you can find a detailed explanation of the PIN directive posted at this URL. Before PBASIC version 2.5, there was no PIN directive, and you had use different ways of referring to pins that had to be used variously as inputs, outputs, and indices.
Sign In or Register to comment.