8Byte EEProm problem Compiler BUG

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
Registered User
Registered User
Posts: 13
Joined: Mon Jul 09, 2007 10:45 am
Location: Germany Barßel

8Byte EEProm problem Compiler BUG

Post by speed64 » Wed Jan 13, 2010 2:17 pm

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,
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
End Sub



CDC.OnControl = OnControl

While true

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

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

GoTo point1

Greeting Speed64

Post Reply