This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problems with communication between C167 and LM629N

Hi all,

i'm a student from germany. I got a problem with the addressing of an external bussystem. My C167 controls six LM629N (Precision Motion Controller IC) for an robot. A SN74LS138 Demux selects the LM629N. The Connections are:

SN74LS138 : C167
/E1 : /CS4
A2 : A3
A1 : A2
A0 : A1

LM629N : C167
D0..D7 : D0..D7
/WR : /WRL
/RD : /RD-U
/PS : A0

SN74LS138 : LM629
/O0../O5 : /CS

My concrete Questions:
1) How to setup the options for memoryspace with addrsel4/buscon4?
2) Wich Memorymodel should i use?
3) How can i read and write data to the LM639N.

I did tones of tries with all possible options,memory-models, near far and huge declarations for pointer, addrsel/buscon settings, dpp configuration .... (for example:

#define BASIS_ADRESSE 0x50000
unsigned char readLM629(unsigned char Achse)
{
 near unsigned char *pointer;
 pointer = ((near unsigned char*)(Achse*2 | BASIS_ADRESSE));
 return *pointer ;
}
just want to read out data from the LM629N)

But the robot didn't move any time :( The configuration was setup by to students years ago and allready worked on their laptop. But want work here :(

If anything missing - ask, i will give my best to explain the construction!

big thx
arthur

Parents
  • @ andy hehe :=)
    @topic
    Thx for the answers. First i think the configuration of CS Signals is right. Selected 5 CS Signal with Switch 3 on the board.
    On Friday i could establish a connection to the LM629N. I used the huge variable declaration instead of far. The students befor me used far and i believed that they know what they did.
    So it wasn't a question of the options, than the right configuration of the functions (also huge) and the variable pointer.
    I also loaded the keil compiler. But it would take to much time for me to work with a nother compiler - having just 3 more days to complete the project.

    So great thanks to all of you. I wish you a nice 1. Advent :)

    Arthur

Reply
  • @ andy hehe :=)
    @topic
    Thx for the answers. First i think the configuration of CS Signals is right. Selected 5 CS Signal with Switch 3 on the board.
    On Friday i could establish a connection to the LM629N. I used the huge variable declaration instead of far. The students befor me used far and i believed that they know what they did.
    So it wasn't a question of the options, than the right configuration of the functions (also huge) and the variable pointer.
    I also loaded the keil compiler. But it would take to much time for me to work with a nother compiler - having just 3 more days to complete the project.

    So great thanks to all of you. I wish you a nice 1. Advent :)

    Arthur

Children
  • Hi Arthur,

    You need to know what memory model you are using and really understand the implications of the hardware of the C167? The Keil compiler for the C166 toolchain has a great number of configurations to provide the user with the best choice for their respective need. I would guess that you are using the default setting of "small" which means functions are assumed to be less than 64Kbyte and variables are assumed to be near. This means that when you define a function as "void foo (void)" in the small memory model the compiler really sees this as "void near foo(void)". Therefore if you need to call a function that is not in the same 64kbyte boundary you need a call that would cause the code segment pointer of the C167 to be updated. This would happen as you said using the "huge" keyword but it would also have worked if you had used "far". As for the variable pointer this again needs understanding of what the C166 hardware does. The "huge" keyword on a variable will issue an extended segment (EXTS) instruction which allows for a bypass to the segment to access the variable (allowing the object to be a maximum size of 64Kbyte). The "far" keyword on a variable will issue an extended page (EXTP) instruction which allows for a bypass of the data page pointer to access the variable (allowing the object to be a maximum size of 16Kyte).

    So hopefully you don't take this as ranting but it is very important that you understand why you need to make these adjustments to your code.

    Kind regards,
    Chris