Quantcast
Channel: MEL PICBASIC Forum
Viewing all articles
Browse latest Browse all 4792

some help with math

$
0
0
Hi guys i need to make this table of value in code
Code:


count                byte code        end value
1        -1        0                0
2                1                      42
3                2                84
4                3              126
5                4              168
6                5              210
7        -7        0              0
8                1            42
9                2              84
10                3            126
11                4            168
12                5            210
13        -13        0            0
14                1            42
15                2            84
16                3            126
17                4            168
18                5            210
19        -19        0            0
20                1          42
21                2          84
22                3          126
23                4          168
24                5          210
25        -25        0          0
26                1          42
27                2          84
28                3          126
29                4          168
30                5          210

code attempt
Code:

Data_Length = 42                                  ' 38chrs + 4 byte setting  - required varable for spi flash routine
        SDC_Page = 129 + (Menu_Subtxt-1)/6                ' page start point + 1 page per each 6 subtxt placed
        IF Menu_subtxt-1 //6 = 0 THEN
            SDC_Byte = 0   
        ELSE 
            SDC_Byte = (Menu_Subtxt-1)+6 *6 + (Menu_Subtxt-1)-6 *6 /6 * Data_Length        ' byte start point per data length
           
        ENDIF


Viewing all articles
Browse latest Browse all 4792

Trending Articles