I’m currently working with some assembler code I don’t often use assembler so my level of understanding is good but not 100% needs brushing up here and there
In my code that I’m working with you normally have all your registers ( should refer to this as General purpose registers ) that you intend to use defined by the following
[code]
cblock 0x10
device.code ; IR device code to send
command.code ; IR command code to send
shift.temp ; ir data temp shift register
counter ; count ir data bits shifted
shift.count ; count bits shifted
endc
[/code]
No problem with this I understand the above since all GPR start at 0x10 on the 10f200 and so this allocates 0X 10 to 0X15 A total of 5 GPRS used If you look at the memory map in the datasheet you can see how this works ,
However I’m getting slightly confused with the dot notation use in the above as well as elsewhere in the code I dont nomally use dot notation in assembler just simple naming convention equally I find this used in the lables for the jump too call statements with sub procedures
I need some help hopefully someone can shed some light on this for me
Question 1
Example why did they use device. code as opposed to just the word code in the cblock statement
Question 2
The next bit of code is really throwing me not that i don’t understand what they are doing but cannot place a watch on this using MPLAB 8.70
[code]
C.device.id equ .1 ; SIRC Device ID [0-31]
; SIRC Command code [0-127]
; to disable a switch set value to .255
C.cmd.S1 equ .8 ; command sent on Switch 1
C.cmd.S2 equ .1 ; command sent on Switch 2
C.cmd.S3 equ .0 ; command sent on Switch 3
[/code]
This shows up in the watch window as restricted memory ( interesting could be quite usefull this especially when it comes to copy rights )
My second part of this question is what do the mean by C Could someone please explain this to me and how this is used , For example in the above code they refer to C.cmd.S1
Normally when using variable names I would simply refer to this as ( cmds1) for example not C.cmd.s1 using thier dot notation , I dont know why this is been done this way or if this is special use for what ever reason , or is this just a naming convention they have decided to use
I do understand from the above code in block two that the dot before the numerical value assigned to the variable is MPASM method of interpreting this back to the compiler as use a decimal number
Example : C.cmd.S1 equ .8
From the above slice I understand that this implies we are assigning decimal 8 to C.cmd.S1
I could have also used C.cmd.S1 equ 0x08 ' would have meant the same
I could really do with some advice as to how this works and why this shows as restricted memory and for what reason
Perhaps this is just me getting slighlty confused as I havent done assembler for quite some time I normally use C or pic basic however for this application instruction time is critical and so must be done in assembler so that we have perfect instruction time so as for the reader of this application such commands can be interpreted correcty without faulting so as to cause correct operation of the final DTE ( Data terminating Equipment )
The above application being the Data communicating equipment (DCE) in this instance
All help and advice greatly appreciated with the above question
Ive also attached datasheet for this device which ive read through but cant see any mention of this usage or how too Ive also read through mpasm help searched on the net for these answers but found no mention of this
Thank you
Mark Harrington
www.harrington.force9.co.uk
Pic 10F200 datasheet
In my code that I’m working with you normally have all your registers ( should refer to this as General purpose registers ) that you intend to use defined by the following
[code]
cblock 0x10
device.code ; IR device code to send
command.code ; IR command code to send
shift.temp ; ir data temp shift register
counter ; count ir data bits shifted
shift.count ; count bits shifted
endc
[/code]
No problem with this I understand the above since all GPR start at 0x10 on the 10f200 and so this allocates 0X 10 to 0X15 A total of 5 GPRS used If you look at the memory map in the datasheet you can see how this works ,
However I’m getting slightly confused with the dot notation use in the above as well as elsewhere in the code I dont nomally use dot notation in assembler just simple naming convention equally I find this used in the lables for the jump too call statements with sub procedures
I need some help hopefully someone can shed some light on this for me
Question 1
Example why did they use device. code as opposed to just the word code in the cblock statement
Question 2
The next bit of code is really throwing me not that i don’t understand what they are doing but cannot place a watch on this using MPLAB 8.70
[code]
C.device.id equ .1 ; SIRC Device ID [0-31]
; SIRC Command code [0-127]
; to disable a switch set value to .255
C.cmd.S1 equ .8 ; command sent on Switch 1
C.cmd.S2 equ .1 ; command sent on Switch 2
C.cmd.S3 equ .0 ; command sent on Switch 3
[/code]
This shows up in the watch window as restricted memory ( interesting could be quite usefull this especially when it comes to copy rights )
My second part of this question is what do the mean by C Could someone please explain this to me and how this is used , For example in the above code they refer to C.cmd.S1
Normally when using variable names I would simply refer to this as ( cmds1) for example not C.cmd.s1 using thier dot notation , I dont know why this is been done this way or if this is special use for what ever reason , or is this just a naming convention they have decided to use
I do understand from the above code in block two that the dot before the numerical value assigned to the variable is MPASM method of interpreting this back to the compiler as use a decimal number
Example : C.cmd.S1 equ .8
From the above slice I understand that this implies we are assigning decimal 8 to C.cmd.S1
I could have also used C.cmd.S1 equ 0x08 ' would have meant the same
I could really do with some advice as to how this works and why this shows as restricted memory and for what reason
Perhaps this is just me getting slighlty confused as I havent done assembler for quite some time I normally use C or pic basic however for this application instruction time is critical and so must be done in assembler so that we have perfect instruction time so as for the reader of this application such commands can be interpreted correcty without faulting so as to cause correct operation of the final DTE ( Data terminating Equipment )
The above application being the Data communicating equipment (DCE) in this instance
All help and advice greatly appreciated with the above question
Ive also attached datasheet for this device which ive read through but cant see any mention of this usage or how too Ive also read through mpasm help searched on the net for these answers but found no mention of this
Thank you
Mark Harrington
www.harrington.force9.co.uk
Pic 10F200 datasheet