Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

syntax quantifying (sum)

Status
Not open for further replies.

erwin4838

Member level 1
Joined
Mar 4, 2012
Messages
32
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Tangerang-indonesia
Activity points
1,478
good afternoon,thanks for u kindnes,please help me for add syntax quantifying (sum),i have syntax for control 2counter,i want 2 counter can be quantifying(sum) for Total value,for example display in Lcd 16X2 :
digit value in counter0 is 10 and digit value in counter1 is 10,picture :
lcd0.JPG
i need you help to change this view to Tot=20 (sum of 2 counter) not Tot=1010

this is my syntax :
Code:
$regfile = "m8535.dat"
$crystal = 16000000
Config Lcdpin = Pin , Rs = Portc.0 , E = Portc.2 , Db4 = Portc.4
Config Lcdpin = Pin , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7
Config Lcd = 16 * 2
Cursor Off
Cls
Config Timer0 = Counter , Edge = Falling
Config Timer1 = Counter , Edge = Falling

Portb.0 = 1
Portb.1 = 1
Lcd "Tot="

Do

   Locate 1 , 5
   Lcd Counter0
   Lcd Counter1

Loop
End
 
Last edited:

try this

Code Basic4GL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$regfile = "m8535.dat"
$crystal = 16000000
Dim Tot As Integer
Config Lcdpin = Pin , Rs = Portc.0 , E = Portc.2 , Db4 = Portc.4
Config Lcdpin = Pin , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7
Config Lcd = 16 * 2
 
Cursor Off
Cls
Config Timer0 = Counter , Edge = Falling
Config Timer1 = Counter , Edge = Falling
 
Portb.0 = 1
Portb.1 = 1
Locate 1 , 1
Lcd "T0=    T1="
Locate 2 , 1
Lcd "Total="
 
Do
 
   Locate 1 , 4
   Lcd Counter0
   Locate 1 , 11
   Lcd Counter1
   Tot = Counter0 + Counter1
   Locate 2 , 7
   Lcd Tot
 
Loop
End

 
try this

Code Basic4GL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$regfile = "m8535.dat"
$crystal = 16000000
Dim Tot As Integer
Config Lcdpin = Pin , Rs = Portc.0 , E = Portc.2 , Db4 = Portc.4
Config Lcdpin = Pin , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7
Config Lcd = 16 * 2
 
Cursor Off
Cls
Config Timer0 = Counter , Edge = Falling
Config Timer1 = Counter , Edge = Falling
 
Portb.0 = 1
Portb.1 = 1
Locate 1 , 1
Lcd "T0=    T1="
Locate 2 , 1
Lcd "Total="
 
Do
 
   Locate 1 , 4
   Lcd Counter0
   Locate 1 , 11
   Lcd Counter1
   Tot = Counter0 + Counter1
   Locate 2 , 7
   Lcd Tot
 
Loop
End


Thank you very much Mr,you syntax 100% work:p
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top