Forum Discussion
Altera_Forum
Honored Contributor
19 years agoHi Di,
Your code looks ok to me but there are some things I'd check. 1) Is the Rx the only interrupt enabled? You don't read the status register to ensure the Rx is the correct source so if another interrupt occurs you will corrupt ByteRec (repeatedly). 2) This is one I've done before. Have you declared Flags as an int in the serial file and then reference it from main as an external char. The test in main reads the wrong char. 3) Is the read of Flags optimised out by the compiler? As it gets altered in the IRQ its best to declare it as volatile. I guess this is the most likley cause of your problem. Banx.