Fair enough. I wondered..That was Senor Martinez comment, not mine.
Max.
Agree on the colons, too.
Fair enough. I wondered..That was Senor Martinez comment, not mine.
Max.
The definition for RA0 and LAT0, which are both bit indexes, are the same (ie; 0) and that's why it works. Not sure if you'd want the assember to report it as an error because you'll often use an alias in your programs... for example;Because, the LATA register (or "file", in this stupid thing) does NOT have an RA0 bit, but rather a LATA0 bit ... the compiler should've reported that as an error ...
#define spkr 0 ; bit index for piezo spkr on RA0
bsf LATA,spkr ;
DelayCy(10*msecs) ;
bcf LATA,spkr ;
I understand now ... thanks for pointing that outThe definition for RA0 and LAT0, which are both bit indexes, are the same (ie; 0) and that's why it works. Not sure if you'd want the assember to report it as an error because you'll often use an alias in your programs... for example;
Code:#define spkr 0 ; bit index for piezo spkr on RA0 bsf LATA,spkr ; DelayCy(10*msecs) ; bcf LATA,spkr ;
;----- PORTA Bits -----------------------------------------------------
RA0 EQU H'0000'
RA1 EQU H'0001'
RA2 EQU H'0002'
RA3 EQU H'0003'
;----- TRISA Bits -----------------------------------------------------
TRISA0 EQU H'0000'
TRISA1 EQU H'0001'
TRISA2 EQU H'0002'
;----- LATA Bits -----------------------------------------------------
LATA0 EQU H'0000'
LATA1 EQU H'0001'
LATA2 EQU H'0002'
;----- ANSELA Bits -----------------------------------------------------
ANSA0 EQU H'0000'
ANSA1 EQU H'0001'
ANSA2 EQU H'0002'
;----- WPUA Bits -----------------------------------------------------
WPUA0 EQU H'0000'
WPUA1 EQU H'0001'
WPUA2 EQU H'0002'
WPUA3 EQU H'0003'
It would in C, but as RA0 and LATA0 both are defined as 0, it matters not in asm...Because, the LATA register (or "file", in this stupid thing) does NOT have an RA0 bit, but rather a LATA0 bit ... the compiler should've reported that as an error ...
You may as well get used to the fact that there are some of us out there that prefer Assembly.I dont know why you need to use assembler
I have learned the PIC RISC and it is akward
.
I'm back ... and I'm glad this thread didn't degenerate into a meaning-of-life discussion, and also glad to see that off-topic comments have been removed ...@cmartinez
I got in the habit of adding the colon on labels, it helps in the process when doing a search for example and the label is used in a few places in the code.
Max.
Code:Main: bsf ADCON0,GO_DONE ; start an A-to-D conversion call InitLCD ; Initialize LCD Special Function Registers clrf Counter clrf TMR1L clrf TMR1H Loop: btfss INTCON,T0IF ; TMR0 is preloaded so than this loop is exited every 23.4ms goto Loop
Errrrr... nope ... but I did browse through the Assembler manual a bit, and corroborated what you said about the colons in labels, among other things. In fact, I have tons of questions regarding syntax. But that's gonna have to wait until I've given enough steps.Did you ever get the Gooligum directory/Index?
Max.

Yes, you can use the ERRORLEVEL directive to suppress the warning. I would recommend that you NOT do that. Put the labels in column 1 like they belong; there is no valid reason to start them anywhere else, even though MPASM is OK with it.I tested MPLAB X IDE's compiler with colons in its labels, and it worked just fine... then I tested it with colons on its labels, and the labels starting at a different column other than one, and the code was compiled correctly, but several warning were shown. Is there a way to tell the compiler not to report that sort of warning?
Pretty much except I get 33.69sec. That's because PR2=255 on my sheet. Not sure if it works when set to 256 (00h).Considering the first equation, and with the MCU running at 31 KHz, then the maximum programmable interrupt period is 33.83 seconds. Is that correct?
it might not work at all ... but I'm sure as hell gonna test it ...Pretty much except I get 33.69sec. That's because PR2=255 on my sheet. Not sure if it works when set to 256 (00h).