Part of the problem is that the baud rate being set by processor expert is not close enough to the target baud rate of 115200. When you enter a baud rate PE will attempt to adjust a divisor to get the baud rate you want, the closest it can get for you is 125000 which gives an error of ~8.5% which is too high.
Franklin wrote:I don't know what PLL is, however the data stream coming in is at 115200 bits per second, and processor expert can be set to either baud (not sure if that is the same as bps) or ticks... which I believe has something to do with the clock.There is an option in the same dialog box (bean settings) for overclocked. I left it alone...I've tried cross connecting, to no avail. It could easily be that I was doing something else wrong at the same time though... suppose i'll try again.
Does the code inside the the if statement ever run? The call to AS1_OnRxCharExt won't do anything, unless you put some code in that function. That function is called in the ISR when a character is received and is empty until you change it, so temp would not be changing. temp2 should be changing, where have you declared these variables and how have you seen that they are not changing?
Franklin wrote:I set it to 24 MHz, 0.16% error, but still no luck.When I run the program, some other unused variables are randomly changing, but the one I am trying to use to hold the received characters does not change. Here is my code...AS1_Enable();for(;
{r = AS1_GetCharsInRxBuf();
if(r>0)
{
AS1_OnRxCharExt(temp);//AS1_RecvBlock(&temp, r, &reall);
AS1_RecvChar(&temp2);
//AS1_SendChar(temp);
}}
Franklin wrote:Also, something I don't understand-- if I used the function AS1_RecvBlock(TComData *block, word size, word *num) How can it store a whole block of data in what is essentially a character variable? (TComData is of type byte, i think? which is of type unsigned char? ) I am confused Any help greatly appreciated!
word RxBytes; // Number of bytes actually loaded into RxDatabyte RxData[10]; // Array to hold extracted databyte Status; // Store any errors returned ...Status = AS1_RecvBlock(RxData,10,&RxBytes); // Attempt to get 10 bytes from AS1
Franklin wrote:I am using the prototyping board PBMCUSLK.The data I am trying to receive looks like this on hyperterminal (at 115200 bps, 8-N-1)
VR=2.0,ID=01:8b:a2:a2:06:00:00:95,SP=BEACON-1,TS=56608
VR=2.0,ID=01:8b:a2:a2:06:00:00:95,SP=BEACON-1,TS=57536
VR=2.0,ID=01:8b:a2:a2:06:00:00:95,SP=BEACON-1,TS=58752
VR=2.0,ID=01:8b:a2:a2:06:00:00:95,SP=BEACON-1,TS=59520
VR=2.0,ID=01:8b:a2:a2:06:00:00:95,SP=BEACON-1,TS=60416
VR=2.0,ID=01:8b:a2:a2:06:00:00:95,SP=BEACON-1,DB=47,DR=1421,TM=1971,TS=61408
VR=2.0,ID=01:8b:a2:a2:06:00:00:95,SP=BEACON-1,DB=41,DR=1248,TM=1606,TS=62208
VR=2.0,ID=01:8b:a2:a2:06:00:00:95,SP=BEACON-1,DB=42,DR=1289,TM=1695,TS=63392
VR=2.0,ID=01:8b:a2:a2:06:00:00:95,SP=BEACON-1,DB=51,DR=1552,TM=1958,TS=64480
VR=2.0,ID=01:8b:a2:a2:06:00:00:95,SP=BEACON-1,DB=51,DR=1555,TM=1769,TS=65536
VR=2.0,ID=01:8b:a2:a2:06:00:00:95,SP=BEACON-1,DB=77,DR=2327,TM=2541,TS=66400
VR=2.0,ID=01:8b:a2:a2:06:00:00:95,SP=BEACON-1,TS=67776
VR=2.0,ID=01:8b:a2:a2:06:00:00:95,SP=BEACON-1,DB=374,DR=11244,TM=11650,TS=68928Every line has a section, DB = xxx. This is a distance measurement from the "listener" device to a beacon, which sends out an ultrasound and RF signal (the Cricket 2.0 system from MIT/crossbow). I need to get three distance readings (from 3 different beacons) and do trilateration to find the co-ordinates of the listener. This is what the hcs12 is intended for. The only problem is that I can't properly interpret the data coming in. I would know what to do if the "temp2" variable held the characters like 'V' and 'I' and 'D' ... clearly following what the input data is supposed to look like. However, I don't think it is being interpreted/translated properly for some reason.I've attached a zip file of the project.