Page 1 of 1

8Byte EEProm problem Compiler BUG

Posted: Wed Jan 13, 2010 2:17 pm
by speed64
Translation by Google, sorry.
Hi, I found an interesting problem.
PIC18F2550 PIC with a USB interface.
Error: whenever I via the USB interface has a name that is 8, 16, 24, 32 bytes long, in the EEProm the CPU to save and then that name again via the USB auslese interface, you add any character back, which no recognizable connection consistent with the transmitted single byte.
Send the name as a string. for example, in the first byte is 100 to recognize the PIC, which is a name that should be saved, then the following byte in ASCII format, depending on how long the name.
Return anything will happen. Does not even the number of bytes. Sent 8 bytes, back 15 or 12 or 14 Read it again to give you the same. Again to send, for example, of the same name or a string. 12345678 is always something else. just like a random generator. I send one byte more or less, everything comes back correctly.

Has someone an idea about this?

{
*****************************************************************************
* Name : testusbeepro.BAS *
* Author : Uwe Kapuschinski *
* Notice : Copyright (c) 2008 Uwe Kapuschinski *
* : All Rights Reserved *
* Date : 14.01.2010 *
* Version : 1.0 *
* Notes : *
* : *
*****************************************************************************
}
Device = 18f2550
Clock = 48

Config PLLDIV = 5,
CPUDIV = OSC1_PLL2,
USBDIV = 2,
FOSC = HSPLL_HS,
VREGEN = ON
Dim c, schleife, receive(36) As Byte

Include "usbcdc.bas"
Include "convert.bas"
Include "eeprom.bas"
Include "utils.bas"

Sub picnameschreiben()

For schleife = 2 To c EE.WriteByte(schleife-2,receive(schleife))Next
EE.WriteByte(c-1,255) EE.WriteByte(c,255)

End Sub


Sub picnamelesen()
Write(" Name: ")
For schleife = 0 To 35 If EE.ReadByte(schleife)=255 Then schleife=35 GoTo point2 EndIf Write(EE.ReadByte(schleife)) Next
point2:
End Sub

c=0

point1:

CDC.OnControl = OnControl

While true

If DataAvailable Then Inc(c) receive(c) = ReadByte DelayMS(1)
Else

If receive(1)=20 Then picnameschreiben receive(1)=0 End If
If receive(1)=10 Then picnamelesen receive(1)=0 End If

c = 0 EndIf
If Not Attached Then GoTo point1 EndIf
Wend

GoTo point1
End

Greeting Speed64