hello guys! Can anyone tell me about the RAM_START codes? What is the operation RAM_START+1 to 4?? RAM_START operation starts at 0x0c? is that correct? Sorry guys..i'm new at assembly.. Thanks guys!!
hello guys! Can anyone tell me about the RAM_START codes? What is the operation RAM_START+1 to 4?? RAM_START operation starts at 0x0c? is that correct? Sorry guys..i'm new at assembly.. Thanks guys!!
what this is doing is defining the ram locations for dcnt0, dcnt1, dcnt2, etc...
RAM_START is 0x0c, therefore, RAM_START+1 is 0x0d... so anytime you use dcnt0, it will use RAM location 0x0d, and 0x0e for dcnt1, etc...
they are floating their declarations instead of using absolutes because if they port this to another micro, that has a RAM that starts at 0x60, then they only have to change one definition, RAM_START, and all the others will be automatically redefined. If he'd used absolutes (dcnt0 = 0x0d) then he'd have to change all his variable declarations as well.
what this is doing is defining the ram locations for dcnt0, dcnt1, dcnt2, etc...
RAM_START is 0x0c, therefore, RAM_START+1 is 0x0d... so anytime you use dcnt0, it will use RAM location 0x0d, and 0x0e for dcnt1, etc...
they are floating their declarations instead of using absolutes because if they port this to another micro, that has a RAM that starts at 0x60, then they only have to change one definition, RAM_START, and all the others will be automatically redefined. If he'd used absolutes (dcnt0 = 0x0d) then he'd have to change all his variable declarations as well.
'floating' means not absolutely nailed down, like the sentence says... they are indirectly defining them. Same thing your assembler does to modules... it assigns a relative address to all the 'labels', relative to the start of the code, then when you link it to your other code modules and locate it, it assigns real values. note, I did not say floating point.... that is a variable type.
"C Block"??? you were in prison???? don't just tell him, show an example of 'how you would use CBLOCK'... like he said, he's new to assembly.
yes, I wholeheartedly admit that. yes I do. Looks like he's learning assy language like I did in the early 80's, cut and paste king. Before that I programmed in machine code... on a 24 bit computer that spoke in octal and prepped and launched 16 nuclear tipped missiles from a submarine... talk about the ability to be dangerous....
People learn far more if they find such simple stuff themselves - examining PIC assembler code, or reading the helpfile, will show exactly what it is and how to use it. Checking my tutorials will also show what it's for - on the later tutorials.
In the respect that they are both essentially text search and replace, yes they do. The 'ram_start+1' is obviously evaluated before the search and replace is done.
They are similar, but not identical - and like I said, CBlock is better for assigning GPR names. Here's an example of it in use:
Code:
cblock 0x20 ;start of general purpose registers
count ;used in looping routines
count1 ;used in delay routine
counta ;used in delay routine
countb ;used in delay routine
tmp1 ;temporary storage
tmp2
templcd ;temp store for 4 bit mode
templcd2
endc
yup! cblock is much easier to understand.. But can i make it the other way around sir?
Code:
LED00 EQU movlw 0
What does readbuf_end do sir? do u have any notes regarding how it can be use, sir?
Code:
tmptr EQU readbuf_end
tmbyte EQU readbuf_end+1
Btw, i found a very interesting way of incorporating keypad in asm..can you help me understand it sir? (i just started studying asm last week..there are alot of things that i don't know yet..and i'm glad that your helping me sir..)
Code:
keytable
movf keycode, W
addwf PCL, F
dt 0x60
dt "123a"
dt "456b"
dt "789c"
dt "*0#d"
keyscan
clrf keycode
movlw 4
movwf rowcnt
movlw 0xfe
tris PORTA
rowscan movlw 0xa0
call udelay
swapf PORTB, W
movwf colstatus
movlw 4
movwf colcnt
colscan incf keycode, F
rrf colstatus, F
btfss STATUS, C
goto keytable
decfsz colcnt, F
goto colscan
bsf STATUS, C
bsf STATUS, RP0
rlf TRISA, F
bcf STATUS, RP0
decfsz rowcnt, F
goto rowscan
retlw 0
It's a good introduction to programming in assembly for PICs. They even have all of the commands defined. So if you want to know what "#define" or "EQU" means...yep, they have it.
Moderator: Can you change the link in the Sticky to Mikro's new website? The above link replaces the one in the Sticky right below Nigel's.
i'm trying to play with the LEDs, by incrementing and decrementing them.. problem is, if i push the up switch(inc) just once, the 2 LEDs are lit instead of just one. I've heard about debouce delay but i don't know how to corporate it with my work.. the LEDs also blink..
If i change the Delay4 value, the delay of the LED to blink is also affected..because i also use the Delay4 as a delay for may led.. I just wanted to try the debounce delay.. Pls teach me how sir..