Searching \ for '[PICs][newbie] MPLAB help' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/begin.htm?key=mplab
Search entire site for: '[newbie] MPLAB help'.

Exact match. Not showing close matches.
PICList Thread
'[PICs][newbie] MPLAB help'
1999\10\24@183049 by John De Villiers

flavicon
face
I need help with MPLAB.

Im busy with a cicuit design and at the same time im writing the code for
it. With some of the i/o lines i havent decided on what ports they should go
yet.

At the moment my code looks something to the effect of

       bsf     porta,0
       bcf     porta,1

Is there a way i can define names for porta,0 and porta,1 so that in the
code i can use the names, instead of the pin names? Then if i move something
around, all i need to do is change the name -> pin assignment and recompile,
instead of searching all the code for porta,0 etc.

Regards
  John

PS - does anyone know off-hand what the length (time) of a spark is in a
vehicle with electronic ignition ?

1999\10\24@185131 by Thomas C. Sefranek

face picon face
John De Villiers wrote:

> I need help with MPLAB.
>
> Im busy with a cicuit design and at the same time im writing the code for
> it. With some of the i/o lines i havent decided on what ports they should go
> yet.
>
> At the moment my code looks something to the effect of
>
>         bsf     porta,0
>         bcf     porta,1
>
> Is there a way i can define names for porta,0 and porta,1 so that in the
> code i can use the names, instead of the pin names?

Sure!

Declare constants for the pin numbers.

Plug1    EQU    0
Plug2    EQU    1
Plug3    EQU    2
etc....
Then you code can be:

   BSF    PORTA,Plug1
   BCF    PORTA,Plug2

> Then if i move something
> around, all i need to do is change the name -> pin assignment and recompile,
> instead of searching all the code for porta,0 etc.
>
> Regards
>    John
>
> PS - does anyone know off-hand what the length (time) of a spark is in a
> vehicle with electronic ignition ?

--
Thomas C. Sefranek  WA1RHP
ARRL Instructor, Technical Specialist, VE Contact.
http://www.harvardrepeater.org
http://hamradio.cmcorp.com/inventory/Inventory.html

1999\10\25@111751 by Lea

picon face
At 12:29 AM 10/25/99 +0200, you wrote:
>        bsf     porta,0
>        bcf     porta,1
>
>Is there a way i can define names for porta,0 and porta,1 so that in the
>code i can use the names, instead of the pin names? Then if i move something
>around, all i need to do is change the name -> pin assignment and recompile,
>instead of searching all the code for porta,0 etc.

Hi John
you can doit, It is very helpfull to know what are you turning setting or
clearing
when writing the code :-).
here is an example:

#define        _txda           PORT_A,1         ;SPI txdata
#define        _rxda           PORT_A,2         ;SPI rxdata
#define        _we             PORT_A,3         ;write enable/1

I usually do it at the begining of the program.

so if you whant to do : BCF PORT_A,1
              just do  BCF _txda
easier isn't it?.

Hope it helps.
see you.
  Leandro J. Laporta (LU2AOQ)
  mail: spam_OUTlu2aoqTakeThisOuTspamyahoo.com
  wrk: Arg. Assoc. for Space Technology.
  ham: TCP/IP high speed group HSG

1999\10\25@123230 by Dwayne Reid

flavicon
face
>Is there a way i can define names for porta,0 and porta,1 so that in the
>code i can use the names, instead of the pin names? Then if i move something
>around, all i need to do is change the name -> pin assignment and recompile,
>instead of searching all the code for porta,0 etc.

Sure!  Use the #define function in MPLAB.  The following is snipped from
working code.  Note that I define all bit variables with a leading
underscore - this is *MY* convention and not required by MPLAB.

To change the pin assignment for any i/o line, all I have to do is change
the #define in ONE location.

; PORT A Device Bits    note: ra 0,1 a/d inputs so no labels for them
   #define _MUXCLK  RA,2        ; RA2, a/d ext mux clk out (active LO)
   #define _MUXRST  RA,3        ; RA3, a/d ext mux reset out (active HI)
   #define _PBWR    RA,4        ; RA4, "WRITE" button (active LO)
   #define _PBRD    RA,5        ; RA5, "READ" button (active LO)

RA_INIT         EQU b'00010000' ;
DDR_A           EQU b'00110011' ; ddr: ra 2,3==out,  ra 0,1,4,5==in
DIPWRMSK        EQU b'00010000' ;
DIPRDMSK        EQU b'00100000' ;

; PORT B Device Bits
   #define _IPCRXD RB,0        ; RB0, IPC data input (active LO)
   #define _IPCTXD RB,1        ; RB1, IPC data out (active HI)
   #define _DHTRLD RB,2        ; RB2, display heater LEDs data output
   #define _DSTAT  RB,3        ; RB3, display status & inputs (bi-dir)
   #define _STROBE RB,4        ; RB4, ctrl, DipSw, disp str, eeprom !CS
   #define _SERCLK RB,5        ; RB5, ctrl, DipSw, display CLOCK
   #define _EECLK  RB,6        ; RB6, eeprom clock
   #define _SERDAT RB,7        ; RB7, ctrl, DipSw, eeprom DATA (bi-dir)

RB_INIT         EQU b'00000001' ;initial port B data status
DDR_B           EQU b'10001001' ;ddr: rb 1,2,4,5,6==out,  rb 0,3,7==in
DDR_BLO         EQU b'10001001' ;AND  0s force bits LO
DDR_BHI         EQU b'00000001' ;OR  1s force bits HI

Hope this helps.

dwayne



Dwayne Reid   <.....dwaynerKILLspamspam@spam@planet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 15 years of Engineering Innovation (1984 - 1999)

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Do NOT send unsolicited commercial email to this email address.
My posting messages to Usenet neither grants consent to receive
unsolicited commercial email nor is intended to solicit commercial
email.

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...