A intermittent oddity.

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
Francis
Registered User
Registered User
Posts: 314
Joined: Sun Mar 25, 2007 9:40 am
Location: Devon

A intermittent oddity.

Post by Francis » Wed Nov 05, 2008 11:57 am

I've got an odd problem with code, which uses (S)UART and USART

It's far too long to post it all here, but basically the section that is giving the trouble does this:

1. Sends a command to an external device , and then reads the returned string into a byte array - via USART.

2. Sends this returned string array out via SUART/UART for viewing in Terminal. This is just for me to see what is being returned. i.e. a 'test-print'.

Most of the time it is fine, but in one case something odd happens.
When sending the string to Terminal it actually sends the text "_DB_StrConst_07590" which is something in the Assembler listing instead of the actual variable value(??).

The line where it apparently errs is:

Code: Select all

uart.write("Rstep= ",dectostr(maxblock),13,10)
Usually this line executes fine and the value of 'Maxblock' is in the range 20 to 500. Maxblock is defined as a Word.

Is this some behaviour with an obvious solution or workaround?
I'd be really grateful for some tips here.

Francis
Registered User
Registered User
Posts: 314
Joined: Sun Mar 25, 2007 9:40 am
Location: Devon

Post by Francis » Wed Nov 05, 2008 12:26 pm

I have cured it without knowing why..

The problem occurred in a Subroutine which was Inline.
I took the 'Inline' out and the problem went.
Weird.
Obviously it was my fault but I can't see what.

TimB
Posts: 262
Joined: Wed Oct 04, 2006 7:25 am
Location: London UK

Post by TimB » Wed Nov 05, 2008 4:55 pm

Glad you fixed it, but I would say there is a fundamental issue there. Worth identifying if you have the time.

Francis
Registered User
Registered User
Posts: 314
Joined: Sun Mar 25, 2007 9:40 am
Location: Devon

Post by Francis » Wed Nov 05, 2008 5:46 pm

It is odd.

I can PM the code.
It does the 'funny' without being connected to the other serial device so should be reproducible on a Dev Board.

I won't post it as it is a bit 'first draft' and rambles on a bit.
(A bit like me really).

Post Reply