Hello Everyone,
Still in an effort to understand this programming language, I now am playing with DIV32.
I have taken the code from the manual and added some serial routines so I can view whats happening. I have posted the code below.
Code:
' Use MPASM
@MyConfig = _HS_OSC & _WDT_OFF & _PWRTE_ON & _MCLRE_ON & _LVP_OFF 
@MyConfig = MyConfig  & _CP_OFF & _BODEN_OFF & _DATA_CP_OFF
@ __config  MyConfig
Define PIC16F628A
define OSC 20
include "modedefs.bas"


a     var word
b     var word
c     var word
Dummy var word
start:
 b = 500
 c = 1000
 
 disable ' 
 
 dummy = b * c
 a = div32 100

 enable
 serout PortB.4,T9600,[254,1]
 pause 100
 serout PortB.4,T9600,[254,128,"dummy is:",# Dummy]
 pause 1000
 serout PortB.4,T9600,[254,192,"A is:", # a]
 pause 1000
 serout PortB.4,T9600,[254,148,"B is:", # b]
 pause 1000
 serout PortB.4,T9600,[254,212,"C is:", # c]
 pause 1000
 goto start
end
The code does what the book says it should do. I have a couple of questions:
the line, a = DIV32 100 . I get that the 100 causes DIV32 to divide by 100, what I do not get is how DIV32 knows to use the math in the above formula, is "Dummy " a default place holder? My second question is the value of Dummy as outputted in line 1 of the display, I get the fact, 5 hundred thousand is too large for 16 bits to hold but 41248 makes no sense to me, can anyone explain?
Thank You
JS