Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 109,157 C++ Programmers for FREE! Ask your question and get quick answers from experts. There are 1,020 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Light on Large arrays

 
Reply to this topicStart new topic

Light on Large arrays, The content written in the array is over written

cpd
post 2 Jul, 2008 - 07:51 AM
Post #1


New D.I.C Head

*
Joined: 12 Nov, 2007
Posts: 1


My Contributions


Hai,

My serial interrupt routine collects all the data from the serial buffer (Controller) successfully, the data sent from the controller never exceed more than 2000 bytes.
The problem is when the controller sends large no. of bytes for eg 400 bytes, the array "RecBuffer" holds all the bytes successfully but when i look at the array RecBUffer after the interrupt routine or at the end in the interrupt routine as i posted below, The data inside the array is different, what manipulation do i need to make in order to make the content remain the same until its is over wriiten.

This above case is not the same for fewer bytes sent, the content is not altered.

[code]
#define ETX 3
unsigned char RecBuffer[2048];
unsigned short count;
void interrupt PORT1INT() /* Interrupt Service Routine (ISR) for PORT1 */
{
unsigned int c;
do
{
c = inportb(PORT1 + 5);
if (c & 1)
{

RecBuffer[count] = inportb(PORT1);
printf("data %x",RecBuffer[count]);
count++;
if (RecBuffer[count-1]==ETX){
count=0;
printf("RecBUffer[0]=%x ",RecBUffer[0]);// to look at the array content at the end of data collection
}
}
} while (c & 1);
outportb(0x20,0x20);
}[\code]

I work on dos, compiler turbo c

many thanks for any help

This post has been edited by cpd: 2 Jul, 2008 - 07:53 AM
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 9/5/08 05:36PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month