Hello Pikczu everything works almost normally except for some ACK / NAK management details. The main problems were: -Allimentation of the LCD -Share of COM1 with USB arduino card - In the Do / Ischarwaiting / Loop function, do not put any other functions. I thank you very much for your help! Bernard :roll: :roll: :smt024
Takes 8 cycles. [i:edee31e49f]0 - s[/i:edee31e49f] takes 202, [i:edee31e49f]-s[/i:edee31e49f] and [i:edee31e49f]-1 * s[/i:edee31e49f] each complete in 279 cycles.[/quote:edee31e49f] Do you truly believe your botchery is useful for an user who does not even know the most simple thing of inverting the sign of a variable? Btw., you're not the only one knowing about the sign-bit, however your code looks bulky and has no ease of use of an a = -a. As you're a clever guy, do some graphs showing cycle savings vs. ugliness of code.
'for Glcd Ks108 'First we define that we use a graphic LCD Config Graphlcd = 128 * 64sed , Dataport = Porta , Controlport = Portc , Ce = 0 , Ce2 = 1 , Cd = 2 , Rd = 3 , Reset = 5 , Enable = 4 , Mode = 6
'The dataport is the portname that is connected to the data lines of the LCD 'The controlport is the portname which pins are used to control the lcd 'CE = CS1 Chip select 'CE2 = CS2 Chip select second chip 'CD = DI Data/instruction 'RD = R/W Read/Write 'RESET = RST reset 'ENABLE = E Chip Enable 'And Potmeter for contrast to +5V, V0, VEE (V0 is center pin on pot)
Dim Char As Byte , L As Byte , C As Byte 'Show lcd ascii on lcd Do
Cls Char = 31 For L = 1 To 8 For C = 0 To 127 Step 8 Char = Char + 1 Lcdat L , C , Chr(char) Next C Next L
Cls Char = 128 For L = 1 To 8 For C = 0 To 127 Step 8 Char = Char + 1 Lcdat L , C , Chr(char) Next C Next L
[quote:0189d22629="six1"][code:1:0189d22629]s=s * -1[/code:1:0189d22629][/quote:0189d22629] As a basic rule multiplications and divisions should be avoided, where additions and subtractions are usable, as the latter are faster: [code:1:0189d22629]s= 0 - s[/code:1:0189d22629] Not much gain in this case, 'only' 28 percent faster. Where speed is required, 28 percent is really something.