Thread: [Flashforth-devel] Pin words
Brought to you by:
oh2aun
From: Mikael N. <mik...@pp...> - 2014-03-25 19:08:39
|
I made some words for manipulating pins on pic18. Any comments or suggestions for the names and structure ? Is there any best practice for pin manipulation ? Would it be better to have pin-in: and pin-out: instead of pin-dir: ? BR Mike \ ********************************************************************* \ * \ Filename: pins.txt * \ Date: 25.03.2014 * \ FF Version: 5.0 * \ MCU: PIC18 * \ Copyright: Mikael Nordman * \ Author: Mikael Nordman * \ ********************************************************************* \ FlashForth is licensed acording to the GNU General Public License* \ ********************************************************************* \ Words for manipulating I/O pins -pins marker -pins \ Define a word that sets a pin direction ( tris bit dir "name" -- ) \ dir : 0 = output, 1 = input : pin-dir: : if a, bsf, else a, bcf, then $12 i, postpone [ ; \ Define a word that sets an output pin ( port bit "name" -- ) : pin-on: : a, bsf, $12 i, postpone [ ; \ Define a word that clears an output pin ( port bit "name" -- ) : pin-off: : a, bcf, $12 i, postpone [ ; \ Define a word that leaves a true flag if a bit is one \ and a false flag if a bit is zero. ( port bit "name" -- ) : pin-in: : ['] false in, a, btfss, $12 i, ['] invert in, $12 i, postpone [ ; $ff82 constant portc $ff94 constant trisc $0000 constant bit0 trisc bit0 0 pin-dir: pc0out trisc bit0 1 pin-dir: pc0in portc bit0 pin-on: pc0on portc bit0 pin-off: pc0off portc bit0 pin-in: pc0? |
From: Herman A. <exp...@vn...> - 2014-03-25 21:36:53
|
It is good idea to use such words, but I think their usage belongs not to the pins only. Any bit usable in similar way. According to this theory the terminology probably: bit-on: bit-off: bit-test: (or bit?:) The name of defined word can refer to its function, such as usage of a pin or function of a bit of a sfr etc. BR Attila ----- Eredeti üzenet ----- Feladó: Mikael Nordman <mik...@pp...> Dátum: Kedd, Március 25, 2014 8:08 Tárgy: [Flashforth-devel] Pin words Címzett: fla...@li... > I made some words for manipulating pins on pic18. > > Any comments or suggestions for the names and structure ? > > Is there any best practice for pin manipulation ? > > Would it be better to have pin-in: and pin-out: instead of pin-dir: ? > > BR Mike > > \ ********************************************************************* > \ * > \ Filename: pins.txt * > \ Date: 25.03.2014 * > \ FF Version: 5.0 * > \ MCU: PIC18 * > \ Copyright: Mikael Nordman > * > \ Author: Mikael Nordman > * > \ ********************************************************************* > \ FlashForth is licensed acording to the GNU General Public License* > \ ********************************************************************* > \ Words for manipulating I/O pins > -pins > marker -pins > > \ Define a word that sets a pin direction > ( tris bit dir "name" -- ) \ dir : 0 = output, 1 = input > : pin-dir: > : > if > a, bsf, > else > a, bcf, > then > $12 i, postpone [ > ; > > \ Define a word that sets an output pin > ( port bit "name" -- ) > : pin-on: > : a, bsf, $12 i, postpone [ > ; > > \ Define a word that clears an output pin > ( port bit "name" -- ) > : pin-off: > : a, bcf, $12 i, postpone [ > ; > > \ Define a word that leaves a true flag if a bit is one > \ and a false flag if a bit is zero. > ( port bit "name" -- ) > : pin-in: > : > ['] false in, > a, btfss, > $12 i, > ['] invert in, > $12 i, postpone [ > ; > > $ff82 constant portc > $ff94 constant trisc > $0000 constant bit0 > > trisc bit0 0 pin-dir: pc0out > trisc bit0 1 pin-dir: pc0in > portc bit0 pin-on: pc0on > portc bit0 pin-off: pc0off > portc bit0 pin-in: pc0? > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > > _______________________________________________ > Flashforth-devel mailing list > Fla...@li... > |
From: Pete Z. <pza...@pz...> - 2014-03-25 23:10:27
|
Well said Herman, I agree... Pete On 3/25/2014 4:36 PM, Herman Attila wrote: > It is good idea to use such words, but I think their usage belongs not to the pins only. > Any bit usable in similar way. According to this theory the terminology probably: > bit-on: > bit-off: > bit-test: (or bit?:) > > The name of defined word can refer to its function, such as usage of a pin or function of a bit of a sfr etc. > > BR > Attila > > > ----- Eredeti üzenet ----- > Feladó: Mikael Nordman <mik...@pp...> > Dátum: Kedd, Március 25, 2014 8:08 > Tárgy: [Flashforth-devel] Pin words > Címzett: fla...@li... > > >> I made some words for manipulating pins on pic18. >> >> Any comments or suggestions for the names and structure ? >> >> Is there any best practice for pin manipulation ? >> >> Would it be better to have pin-in: and pin-out: instead of pin-dir: ? >> >> BR Mike >> >> \ ********************************************************************* >> \ * >> \ Filename: pins.txt * >> \ Date: 25.03.2014 * >> \ FF Version: 5.0 * >> \ MCU: PIC18 * >> \ Copyright: Mikael Nordman >> * >> \ Author: Mikael Nordman >> * >> \ ********************************************************************* >> \ FlashForth is licensed acording to the GNU General Public License* >> \ ********************************************************************* >> \ Words for manipulating I/O pins >> -pins >> marker -pins >> >> \ Define a word that sets a pin direction >> ( tris bit dir "name" -- ) \ dir : 0 = output, 1 = input >> : pin-dir: >> : >> if >> a, bsf, >> else >> a, bcf, >> then >> $12 i, postpone [ >> ; >> >> \ Define a word that sets an output pin >> ( port bit "name" -- ) >> : pin-on: >> : a, bsf, $12 i, postpone [ >> ; >> >> \ Define a word that clears an output pin >> ( port bit "name" -- ) >> : pin-off: >> : a, bcf, $12 i, postpone [ >> ; >> >> \ Define a word that leaves a true flag if a bit is one >> \ and a false flag if a bit is zero. >> ( port bit "name" -- ) >> : pin-in: >> : >> ['] false in, >> a, btfss, >> $12 i, >> ['] invert in, >> $12 i, postpone [ >> ; >> >> $ff82 constant portc >> $ff94 constant trisc >> $0000 constant bit0 >> >> trisc bit0 0 pin-dir: pc0out >> trisc bit0 1 pin-dir: pc0in >> portc bit0 pin-on: pc0on >> portc bit0 pin-off: pc0off >> portc bit0 pin-in: pc0? >> >> >> ------------------------------------------------------------------------------ >> Learn Graph Databases - Download FREE O'Reilly Book >> "Graph Databases" is the definitive new guide to graph databases and their >> applications. Written by three acclaimed leaders in the field, >> this first edition is now available. Download your free book today! >> >> _______________________________________________ >> Flashforth-devel mailing list >> Fla...@li... >> > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > _______________________________________________ > Flashforth-devel mailing list > Fla...@li... > https://lists.sourceforge.net/lists/listinfo/flashforth-devel > > |
From: Mikael N. <mik...@pp...> - 2014-03-26 05:24:23
|
Since these words actually only work with SFRs in access ram they could be called sfrbit-on: sfrbit-off: sfrbit-test: The words that work with the whole ram space could be bit-on: bit-off: bit-test: These words need to generate code to set the bank bits also. BR Mike On 03/25/2014 11:36 PM, Herman Attila wrote: > It is good idea to use such words, but I think their usage belongs not to the pins only. > Any bit usable in similar way. According to this theory the terminology probably: > bit-on: > bit-off: > bit-test: (or bit?:) > > The name of defined word can refer to its function, such as usage of a pin or function of a bit of a sfr etc. > > BR > Attila |
From: Herman A. <exp...@vn...> - 2014-03-26 06:48:45
|
Really, this distinction needed for optimal speed. BR Attila ----- Eredeti üzenet ----- Feladó: Mikael Nordman <mik...@pp...> Dátum: Szerda, Március 26, 2014 6:24 Tárgy: Re: [Flashforth-devel] Válasz: Pin words Címzett: fla...@li... > Since these words actually only work with SFRs in access ram they > could be > called > > sfrbit-on: > sfrbit-off: > sfrbit-test: > > The words that work with the whole ram space could be > > bit-on: > bit-off: > bit-test: > > These words need to generate code to set the bank bits also. > > BR Mike > > On 03/25/2014 11:36 PM, Herman Attila wrote: > > It is good idea to use such words, but I think their usage belongs > not to the pins only. > > Any bit usable in similar way. According to this theory the > terminology probably: > > bit-on: > > bit-off: > > bit-test: (or bit?:) > > > > The name of defined word can refer to its function, such as usage of > a pin or function of a bit of a sfr etc. > > > > BR > > Attila > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > > _______________________________________________ > Flashforth-devel mailing list > Fla...@li... > |
From: Herman A. <exp...@vn...> - 2014-03-26 07:32:33
|
Sorry for my poor english... I want to say, I agree with using different words for SFRs and whole ram. Attila ----- Eredeti üzenet ----- Feladó: Mikael Nordman <mik...@pp...> Dátum: Szerda, Március 26, 2014 7:52 Tárgy: Re: [Flashforth-devel]Pin words Címzett: Herman Attila <exp...@vn...> > Sorry, I dont fully understand. > Do you mean that it should or should not be optimized for speed ? > > BR Mikael > On 03/26/2014 08:44 AM, Herman Attila wrote: > > Really, this distinction needed for optimal speed. > > > > BR > > Attila > > > > ----- Eredeti üzenet ----- > > Feladó: Mikael Nordman <mik...@pp...> > > Dátum: Szerda, Március 26, 2014 6:24 > > Tárgy: Re: [Flashforth-devel] Válasz: Pin words > > Címzett: fla...@li... > > > > > >> Since these words actually only work with SFRs in access ram they > >> could be > >> called > >> > >> sfrbit-on: > >> sfrbit-off: > >> sfrbit-test: > >> > >> The words that work with the whole ram space could be > >> > >> bit-on: > >> bit-off: > >> bit-test: > >> > >> These words need to generate code to set the bank bits also. > >> > >> BR Mike > >> > >> On 03/25/2014 11:36 PM, Herman Attila wrote: > >>> It is good idea to use such words, but I think their usage belongs > >> not to the pins only. > >>> Any bit usable in similar way. According to this theory the > >> terminology probably: > >>> bit-on: > >>> bit-off: > >>> bit-test: (or bit?:) > >>> > >>> The name of defined word can refer to its function, such as usage > of > >> a pin or function of a bit of a sfr etc. > >>> BR > >>> Attila > >> > >> ------------------------------------------------------------------------------ > >> Learn Graph Databases - Download FREE O'Reilly Book > >> "Graph Databases" is the definitive new guide to graph databases > and their > >> applications. Written by three acclaimed leaders in the field, > >> this first edition is now available. Download your free book today! > >> > >> _______________________________________________ > >> Flashforth-devel mailing list > >> Fla...@li... > >> > |