What I can't figure out, is how to write data to a specific 8 pins without modifying all of the other pins on the port. In the sketch above, the value 128 should remain present on PortC19 until I start writing to that block again, but what actually happens is it gets set to zero as soon as I start the next loop. I realize that I could OR the port with the new value but then if the pin was already high and I need to write a 0 to it it won't change. Has anyone been able to solve this problem?

What I can't figure out, is how to write data to a specific 8 pins without modifying all of the other pins on the port. In the sketch above, the value 128 should remain present on PortC19 until I start writing to that block again, but what actually happens is it gets set to zero as soon as I start the next loop. I realize that I could OR the port with the new value but then if the pin was already high and I need to write a 0 to it it won't change. Has anyone been able to solve this problem?

jiblets

Thanks, I will remember that, but it doesnt quite solve the problem. I still need to be able to write all values synchronously. I suppose I could clear that block on the port and then OR it with the new value, but its an extra step that would need to be performed each time and I would like to avoid it.

Thanks, I will remember that, but it doesnt quite solve the problem. I still need to be able to write all values synchronously. I suppose I could clear that block on the port and then OR it with the new value, but its an extra step that would need to be performed each time and I would like to avoid it.

I don't think that's possible. The registers are 32 bit. But if you don't use the remaining pins, you can just use

You're almost there - what you have to do is use REG_PIOC_OWER and REG_PIOC_OWDR to mask off which pins you want to alter before writing REG_PIOC_ODSR to change them - the other bits will stay as outputs and stay unchanged. REG_PIOC_OWER = 0x000003FC ; REG_PIOC_OWDR = 0x000FF000 ; lets you change 2-9 leaving 12-19 unchangedREG_PIOC_OWER = 0x000FF000 ; REG_PIOC_OWDR = 0x000003FC ; lets you change 12-19 leaving 2-9 unchanged

dishimwe

You're almost there - what you have to do is use REG_PIOC_OWER and REG_PIOC_OWDR to mask off which pins you want to alter before writing REG_PIOC_ODSR to change them - the other bits will stay as outputs and stay unchanged. REG_PIOC_OWER = 0x000003FC ; REG_PIOC_OWDR = 0x000FF000 ; lets you change 2-9 leaving 12-19 unchangedREG_PIOC_OWER = 0x000FF000 ; REG_PIOC_OWDR = 0x000003FC ; lets you change 12-19 leaving 2-9 unchanged

how can i do the same thing but instead of setting them as output, use them as input?I have tried this but it does not seem to work

Due PinPortChannel0A81A92B253C284C265C256C247C238C229C2110C2911D712D813B2714D415D516A1317A1218A1119A1020A1221A1322B2623A1424A1525D026D127D228D329D630D931A732D1033C134C235C336C437C538C639C740C841C942A1943A2044C1945C1846C1747C1648C1549C1450C1351C1252B2153B14