Re: [Flashforth-devel] Pin words
Brought to you by:
oh2aun
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 > > |