cancel
Showing results for 
Search instead for 
Did you mean: 

Using ST Visual Developer with Cosmic-C compiler. Why do I keep getting "Invalid indirection operand" when creating a pointer?

JKain.1
Associate

I'm using ST Visual Developer with Cosmic-C compiler.

Writing code for STM8S903K3.

Making a pointer to get the value from a SPR register, ADC_DRH:

uint8_t *pv;

pv = *0x005404;

I keep getting the errors;

#error cpstm8 main.c:85(8+8) invalid indirection operand

#error cpstm8 main.c:86(1+7) misplaced local declaration

Don't know what I'm doing wrong.

1 REPLY 1
alister
Lead

STVD hasn't provided the register definitions? Code'll never be pretty if you're poking memory like this. But if you insist...

  volatile uint8_t *pv = (uint8_t *)0x005404;
  *pv = <whatever you want to write>;