Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reading piom space from C
#1
I am now on the learning curve for C coding on the PPMAC. I would like to access I/O memory that I believe the ACC84E occupies. Mainly the raw data coming in from a Renishaw BiSS encoder. In script this is defined as

Sys.piom + $A00000; // address of lower 24 bit
Sys.piom + $A00004; // address of upper 8 bits

How can I access these using C ?
Reply
#2
You should be able to do the following:

Code:
int *LowerWord, *UpperWord;
int EncoderValue;

LowerWord = (unsigned*)((unsigned)piom+0xA00000);
UpperWord = (unsigned*)((unsigned)piom+0xA00004);

EncoderValue = ((*UpperWord&0xFF)<<24)|(*LowerWord);
Sina Sattari
Hardware Engineering Manager
Delta Tau Data Systems, Inc.
Reply
#3
(07-12-2012, 01:45 PM)Sina Wrote: You should be able to do the following:

Code:
int *LowerWord, *UpperWord;
int EncoderValue;

LowerWord = (unsigned*)((unsigned)piom+0xA00000);
UpperWord = (unsigned*)((unsigned)piom+0xA00004);

EncoderValue = ((*UpperWord&0xFF)<<24)|(*LowerWord);

Thanks Sina, I am also trying to debug this user servo routine but I don't think the breakpoints are working or I am using the debugger incorrectly.

I entered it in the servo table and I know it's running because I can set a watchpoint on a Motor variable that I am incrementing inside of it.
Reply
#4
dennisg,

The user servo routine is running in real time kernel and is being called every servo interrupt. You wouldn't expect for us to be able to interrupt and interrupt, correct?

May I ask what you're trying to do in your user servo?
Sina Sattari
Hardware Engineering Manager
Delta Tau Data Systems, Inc.
Reply
#5
(07-13-2012, 08:57 AM)Sina Wrote: dennisg,

The user servo routine is running in real time kernel and is being called every servo interrupt. You wouldn't expect for us to be able to interrupt and interrupt, correct?

May I ask what you're trying to do in your user servo?

Not breaking in an interrupt context makes perfect sense, had not thought of it that way.

Right now I am just trying to become familiar with the Delta Tau architecture and environment. Quite a bit different from embedded controls programming I have done in the past.

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)