Jump to content
Sign in to follow this  
OTLSound

Trouble Copy Data From Inport 18f4523

Recommended Posts

Hi people, here are a strange problem.(at least for me)

I am not a wery experienced programmer, but i make a lot of hardware.

 

PIC : 18F4523

Sourceboost ver 6.96

OS: XP

 

unsigned char Rxbuf[5],counter,c;

 

I have trouble copying data from a variable <c> to an buffer: Rxbuf[counter++]=c.

 

The var <c> ic holding data, and is collected from the rcreg. The buffer <Rxbuf[n++]> does

not get any update, even if the counter is advancing. (trigged by incoming characters from uart).

I have tried printing out the var <c> and and the <counter>, and the data seems to be ok.

 

Have anybody else had this experience?. This is working fine on other 16 PIC's.

 

I work on a MIDI interface, so i needed more space and speed. This seems to be a good

choice at the time, but now ???, i dont know. Too many hours to get 10000 registers set up right.

The compiler give no error. Can it be some chip artifacts?.

I was planning to implementing the NOVO RTOS later.

 

The example of trouble below, also reflects the same problem of copy data between functions.

f ex: puts("Hello"); will not work on 18F4523, but is ok on a 16F887.

/*

 

//this seems to work in a pic16F887, but not in the 18F4523:

void puts(const char *s)

{

while (*s) putraw(*s++);

}

 

 

//this was needed for the pic18F4523 to work ??

void puts(rom unsigned char *s )

{

unsigned char i,cl=0;

 

cl=strlen(s);

for(i=0;i<cl;i++) {

putraw(s);

}

}

 

Any clues, anybody?

 

 

Building...

BoostC Optimizing C Compiler Version 6.96 (for PIC18 architecture)

http://www.sourceboost.com

Copyright© 2004-2009 Pavel Baranov

Copyright© 2004-2009 David Hobday

 

Licensed to Farn50831 under Single user Pro License for 1 node(s)

Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited

 

 

ES30_18F.c

 

success

BoostLink Optimizing Linker Version 6.96

http://www.sourceboost.com

Copyright© 2004-2009 Pavel Baranov

Copyright© 2004-2009 David Hobday

 

 

Building CASM file

Memory Usage Report

===================

RAM available:1536 bytes, used:63 bytes (4.2%), free:1473 bytes (95.8%),

Heap size:1473 bytes, Heap max single alloc:127 bytes

ROM available:32768 bytes, used:1880 bytes (5.8%), free:30888 bytes (94.2%)

 

 

 

success

"C:\Program Files\SourceBoost\boostc_pic18.exe" ES30_18F.c -t PIC18F4523 -W2

"C:\Program Files\SourceBoost\boostlink_pic.exe" /ld "C:\Program Files\SourceBoost\lib" libc.pic18.lib ES30_18F.obj /t

 

PIC18F4523 /d "C:\Program Files\SourceBoost\ES30_18F" /p ES30_18F

Done :(

Share this post


Link to post
Share on other sites

OTLSound,

The example of trouble below, also reflects the same problem of copy data between functions.

f ex: puts("Hello"); will not work on 18F4523, but is ok on a 16F887.

Please provide a small but complete program so we have an example of exactly what you think is not working.

 

Regards

Dave

Share this post


Link to post
Share on other sites
OTLSound,
The example of trouble below, also reflects the same problem of copy data between functions.

f ex: puts("Hello"); will not work on 18F4523, but is ok on a 16F887.

Please provide a small but complete program so we have an example of exactly what you think is not working.

 

Regards

Dave

 

Hi and thanks for fast response :0)

 

Is it ok to send a zip, or shall i just insert it as a replay?

It is a long file. Can we send files as attachments?

I have no experience using this forum.

Anyway i can't do much before tomorrow.

 

regards

H.Pallesen

Share this post


Link to post
Share on other sites
It is a long file. Can we send files as attachments?
Yes

 

Please cut the project and source code down to the minimum needed to demonstrate the problem.

Zip up only the .h .c and .__c files and post that.

 

Regards

Dave

Share this post


Link to post
Share on other sites
It is a long file. Can we send files as attachments?
Yes

 

Please cut the project and source code down to the minimum needed to demonstrate the problem.

Zip up only the .h .c and .__c files and post that.

 

Regards

Dave

 

 

Here are the source.

regards

Harald

ES30_18F.zip

Share this post


Link to post
Share on other sites

Harald,

Here are the source.
We really want a greatly simplified program, one with just a few functions and one that demonstrates the problem under the SourceBoost Debugger.

Please cut it down to a minimum.

 

Regards

Dave

Share this post


Link to post
Share on other sites
Harald,
Here are the source.
We really want a greatly simplified program, one with just a few functions and one that demonstrates the problem under the SourceBoost Debugger.

Please cut it down to a minimum.

 

Regards

Dave

 

Hi again!

 

Now i have got the chip to run after a better reset and initialising sequence.

There is still some strange things happen, I will investigate more in the evening

Things look better now. I use the latest Sourceboost version now. :(

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...