Issue with new Compiler update
Moderators: David Barker, Jerry Messina
Issue with new Compiler update
Last night I've updated to the newest compiler version. When start working this morning (which is a build and a debug run) I realized that I suddenly could not talk (via a piggy bag board RS485) to a set of custom boards in my project. The cards did not answer anymore. It took me until this afternoon to remember that I've updated (silly me!). I reversed to the last version of the compiler (which is also used by MPLAB) and voila... everything is good again. Unfortunately, I do not have the time to look deeper in the issue, but you should know it. Actually, I would be able to supply the source code.
- David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
- Contact:
Re: Issue with new Compiler update
Try downloading the latest BETA
http://www.sfcompiler.co.uk/downloads/beta/
If that does not fix your problem, you need to post the minimal amount of code that shows the problem so I can reproduce the error here.
http://www.sfcompiler.co.uk/downloads/beta/
If that does not fix your problem, you need to post the minimal amount of code that shows the problem so I can reproduce the error here.
Re: Issue with new Compiler update
Thanks David. I will try!
Unfortunately, I do not know what the minimum code footage is. As I mentioned I am running out of time to meet an important deadline and do not have much time. Lets see.
M.
Unfortunately, I do not know what the minimum code footage is. As I mentioned I am running out of time to meet an important deadline and do not have much time. Lets see.
M.
- David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
- Contact:
Re: Issue with new Compiler update
OK, I understand - but please note that I can only fix problems with code that show an error. Just saying something is broken does not really help me...
Re: Issue with new Compiler update
I know...users are a pain...
- David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
- Contact:
Re: Issue with new Compiler update
> ...users are a pain
Sometimes! Seriously though, I would like to get to the bottom of this...
Sometimes! Seriously though, I would like to get to the bottom of this...
Re: Issue with new Compiler update
Me. too! I will do what ever is possible!
Re: Issue with new Compiler update
Tested the beta. Same as update. I attached the core routines I use in the relevant functions including the INCLUDES. Maybe that helps.
PS: Its not a zip file but actually a bas file. uploader does not accept bas or txt files.
PS: Its not a zip file but actually a bas file. uploader does not accept bas or txt files.
- Attachments
-
- RS485 Half duplex.zip
- This routine communicates via half duplex RS485 with custom boards.
- (5.5 KiB) Downloaded 182 times
- David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
- Contact:
Re: Issue with new Compiler update
Sorry, I am unable to build the supplied file here.
(a) Please try and supply some working code that displays the anomaly.
(b) If you can also describe the problem you are seeing.
(c) Finally, if you attach the *.asm files of your actual program build using (a) old, working version of the compiler and (b) the latest, non-working version of the compiler, that would also help.
(a) Please try and supply some working code that displays the anomaly.
(b) If you can also describe the problem you are seeing.
(c) Finally, if you attach the *.asm files of your actual program build using (a) old, working version of the compiler and (b) the latest, non-working version of the compiler, that would also help.
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: Issue with new Compiler update
Just FYI to all -
Having done this a number of times it's best if you can boil it down to the offending code, but sometimes that's a bit tricky since things can change when you remove files.
If you can't do that then you need to supply ALL the files exactly as you build them (minus any standard libraries). The slightest change, however seemingly insignificant, can make a difference.
Having done this a number of times it's best if you can boil it down to the offending code, but sometimes that's a bit tricky since things can change when you remove files.
If you can't do that then you need to supply ALL the files exactly as you build them (minus any standard libraries). The slightest change, however seemingly insignificant, can make a difference.
Re: Issue with new Compiler update
Hello David and Jerry,
I tried to reduce the problem to the bone using only USART, WDT and OnTimer () even though I have found many in the views on GLCD.
Unfortunately, this afternoon, I can not help you in the test because I have commitments.
Tonight I try to take a look at the forum.
In this example
- with 2.2.2.2 return in RS232 exactly
for V times
- with 2.2.2.4.B2 return
1)if V and I as Integer
and never ending
2)if v and i as Word
for V times .
Main program:
Config file:
Called by timers:
I tried to reduce the problem to the bone using only USART, WDT and OnTimer () even though I have found many in the views on GLCD.
Unfortunately, this afternoon, I can not help you in the test because I have commitments.
Tonight I try to take a look at the forum.
In this example
- with 2.2.2.2 return in RS232 exactly
Code: Select all
10<CR><LF>
...
60<CR><LF>
- with 2.2.2.4.B2 return
1)if V and I as Integer
Code: Select all
43130956<CR><LF>
43130956<CR><LF>
43130956<CR><LF>
43130956 ..
2)if v and i as Word
Code: Select all
655370<CR><LF>
20<CR><LF>
30<CR><LF>
40<CR><LF>
50<CR><LF>
60<CR><LF>
..
Main program:
Code: Select all
Device = 18F4685
Clock = 40
Include "Config_V3_WDT.bas"
Include "ISRTimer.bas"
Include "health"
Include "usart"
Include "convert"
Const Timer1 = 0 // Timer per flashing Health
Public Inline Sub ClrWDT()
Asm-
ClrWDT
End Asm
End Sub
Private Sub Initialize()
Timer.Initialize(1)
Timer.Items(Timer1).Interval = 10 // 10ms
Timer.Items(Timer1).OnTimer = @Health.Task // timer event handler
Timer.Items(Timer1).Enabled = true
Timer.Start
USART.SetBaudrate(br115200)
DelayMS(1000)
End Sub
Dim i As Integer
Dim v As Integer
Initialize()
i = 0
v = 5
While v>0
ClrWDT
For i = 0 To 5
USART.Write(DecToStr(20 + 10 * ( i-1 )),#13,#10)
Next
Dec(v)
Wend
Code: Select all
Module Config_V3_WDT
#if _Device in (18F4685,18F2682)
Config
OSC = HSPLL,
PWRT = On,
WDT = On,
WDTPS = 32768,
MCLRE = off,
LVP = OFF,
PBADEN = OFF,
STVREN = off,
#if isoption(PROTECT) And PROTECT = true
CP0 = On,
CP1 = On,
CP2 = On,
CP3 = On,
CP4 = On,
#if _device = 18F4685
CP5 = On,
#endif
EBTR0 = On,
EBTR1 = On,
EBTR2 = On,
EBTR3 = On,
EBTR4 = On,
#if _device = 18F4685
EBTR5 = On,
#endif
CPD = On,
CPB = On,
#else
CP0 = off,
#endif
BOREN = off
#else
#error "Invalid device for HSPLL."
#endif
' Include "SetDigitalIO.bas"
Include "Utils"
SetAllDigital()
Code: Select all
Module Health
Dim HLTH_PIN As PORTA.1
Dim HealthOn As Integer // Tempo di accensione led Health
Dim HealthOff As Integer // Tempo di spegnimento led Health
Public Event Task()
If HLTH_PIN = 0 Then
If HealthOff > 400 Then
High(HLTH_PIN)
HealthOff = 0
HealthOn = 0
Else
Inc(HealthOff)
End If
Else
If HealthOn > 4 Then
Low(HLTH_PIN)
HealthOff = 0
HealthOn = 0
Else
Inc(HealthOn)
End If
End If
End Event
Output(HLTH_PIN) // Health Led
HealthOff = 0
HealthOn = 0
- Attachments
-
- xDavid-with-2.2.2.4.B2-Words.zip
- (59.19 KiB) Downloaded 193 times
-
- xDavid-with-2.2.2.4.B2-Integers.zip
- (59.87 KiB) Downloaded 173 times
-
- xDavid-with-2.2.2.2.zip
- (58.23 KiB) Downloaded 194 times
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: Issue with new Compiler update
For MichaelL's problem, I think the issue is in the CalcChecksum() function.
With the FOR loop index declared as an integer, the loop doesn't perform the req'd number of iterations
I used SF2224B2.
I'll try and reproduce Coccoliso's issue.
With the FOR loop index declared as an integer, the loop doesn't perform the req'd number of iterations
Code: Select all
dim buffer(20) as byte
dim crc8 as byte
Function CalcChecksum(Length As Byte) As Byte
Dim P As Integer // with index signed, the for loop terminates early
'dim P as word // with index as unsigned, it works
Dim C As Byte
CRC8 =0
For P = 0 To Length -1
c = Buffer(P)
c = c Xor CRC8
CRC8 = 0
If c.0 = 1 Then
CRC8 = CRC8 Xor $5e
EndIf
If c.1 = 1 Then
CRC8 = CRC8 Xor $bc
EndIf
If c.2 = 1 Then
CRC8 = CRC8 Xor $61
EndIf
If c.3 = 1 Then
CRC8 = CRC8 Xor $c2
EndIf
If c.4 = 1 Then
CRC8 = CRC8 Xor $9d
EndIf
If c.5 = 1 Then
CRC8 = CRC8 Xor $23
EndIf
If c.6 = 1 Then
CRC8 = CRC8 Xor $46
EndIf
If c.7 = 1 Then
CRC8 = CRC8 Xor $8c
EndIf
Next
CalcChecksum =CRC8
End Function
dim i as byte
main:
// fill buffer with data
for i = 0 to bound(buffer)
buffer(i) = i
next
i = calcchecksum(10)
I'll try and reproduce Coccoliso's issue.
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: Issue with new Compiler update
Similar FOR loop issue w/a signed index, but in this case the loop never terminates... index I never changes value.
src attached. I didn't notice an issue with 'v', but maybe I just missed it.
Code: Select all
'{
// doesn't work... 'I' never changes
Dim i As Integer
Dim v As Integer
'}
{
// works
Dim i As word
Dim v As word
}
{
// works also
Dim i As word
Dim v As Integer
}
Initialize()
v = 5
While v>0
ClrWDT
For i = 0 To 5 // with I signed, it never changes value
USART.Write(DecToStr(20 + 10 * ( i-1 )),#13,#10)
ClrWDT // just added for breakpoint
Next
Dec(v)
Wend
- Attachments
-
- sftest11.zip
- (1.47 KiB) Downloaded 179 times
- David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
- Contact:
Re: Issue with new Compiler update
OK, I've uploaded a new BETA (B3)
http://www.sfcompiler.co.uk/downloads/beta/
Let me know if it fixes the problem for you...
http://www.sfcompiler.co.uk/downloads/beta/
Let me know if it fixes the problem for you...
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: Issue with new Compiler update
2224B3 seems to have fixed the FOR index issue in both cases, but there's still a problem w/Coccoliso's example.
I've simplified it some...
The math in both the "j=" statement and the usart.write() aren't working properly.
I've simplified it some...
Code: Select all
Include "usart"
Include "convert"
Public Inline Sub ClrWDT()
Asm-
ClrWDT
End Asm
End Sub
Dim i As integer
Dim v As Integer
dim j as integer
USART.SetBaudrate(br115200)
v = 5
While v>0
ClrWDT
For i = 0 To 5
j = 20 + 10 * ( i-1 ) // j is incorrect
USART.Write("j=", dectostr(j), " math=", DecToStr(20 + 10 * ( i-1 )),#13,#10) // these should print the same values, but don't
ClrWDT // just added for breakpoint
Next
Dec(v)
Wend
i = 0