switch matrix - output assign

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

switch matrix - output assign

1,090 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cosborne2000 on Tue Jun 24 09:41:24 MST 2014
The reference manual states that you cannot assign multiple outputs to a pin.

When I assign an output to a pin that has been used previously, does the new value overwrite the old or do I need to move any previous output function to pin 255?
标签 (1)
0 项奖励
回复
6 回复数

1,048 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mubes on Thu Jun 26 01:59:05 MST 2014
Ah, I hadn't thought it through. I went to look at my code;

I switch the pin from MISO to a GPIO ... which is effectively returning it to it's 0xFF function;

case SPI_DEVICE_OLED:
  // Switch MISO to be the C/D pin
  LPC_SWM->PINASSIGN4=(LPC_SWM->PINASSIGN4&0xFFFF0000)|(SPI_MOSI)|0xFF00;  
  LPC_GPIO_PORT->DIR0 |= (1 << SPI_MISO);
  break;


...of course, if you were putting a new function out on the pin, it would be a good idea to remove the old function first   One thing I've not tried yet is putting the same function out through multiple pins at the same time. I had a bright idea about doing that to set the RGB colour on a VGA bit driver from the SPI shift register, but not got around to trying it yet.

Thanks for the course correction.

DAVE
(Edited because of silly error when cutting/pasting code, which made the code invalid)
0 项奖励
回复

1,048 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by starblue on Thu Jun 26 01:07:04 MST 2014

Quote: mc
In this case you will have to disassociate previous function to pin.



Will assigning two output functions with different logic levels damage the chip? Or will the chip prevent that?

Jürgen
0 项奖励
回复

1,048 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Wed Jun 25 07:06:00 MST 2014
Hi Dave,
There are two scenarios.

1) Assigning one function to different pins at different time. This can be done.

2) Assuming that cosborne2000 is assigning two functions to same pin. This can be done by two separate PINASSIGNx registers or separate byte of one PINASSIN register. In this case you will have to disassociate previous function to pin.
0 项奖励
回复

1,048 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mubes on Wed Jun 25 03:13:16 MST 2014
Oh, this is interesting...and I may well be doing it wrong then! Given that writing a new value into the register allocates its new function what is the purpose of going via the dissociation first?

Not arguing, just curious....

Dave 
0 项奖励
回复

1,048 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Tue Jun 24 13:07:50 MST 2014
Hi cosborne2000,
Before assigning new function to a pin, please dissociate previous function assigned to this pin.
0 项奖励
回复

1,048 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mubes on Tue Jun 24 11:42:17 MST 2014
I always just replace the old with the new (I do it frequently to turn the MISO pin into a command/data pin for a write-only OLED)....not seen any problems so far.

Dave
0 项奖励
回复