-
1. Re: Anyone know how to read a digital input pin?
DaHu_285096 Mar 12, 2015 9:59 PM (in response to DaHu_285096)Wavform of signal applied to pins
-
DAT and CL_DAT waveform1.JPG 63.0 K
-
-
2. Re: Anyone know how to read a digital input pin?
DaHu_285096 Mar 13, 2015 2:16 AM (in response to DaHu_285096)I finally have the digital inputs working. Now just need to figure out how to make one of them an interrupt in firmware.
For my 3 pins on Port 4;
CY_SYS_PINS_SET_DRIVE_MODE(CYREG_PRT4_PC,0,CY_SYS_PINS_DM_DIG_HIZ);
CY_SYS_PINS_SET_DRIVE_MODE(CYREG_PRT4_PC,1,CY_SYS_PINS_DM_DIG_HIZ);
CY_SYS_PINS_SET_DRIVE_MODE(CYREG_PRT4_PC,2,CY_SYS_PINS_DM_DIG_HIZ);
CyGlobalIntEnable;
for(;;){
WakePin = CY_SYS_PINS_READ_PIN(CYREG_PRT4_PS,2);
if(WakePin){
SampleLFData();
}
-
3. Re: Anyone know how to read a digital input pin?
JoMe_264151 Mar 13, 2015 3:10 AM (in response to DaHu_285096)I had to change a bit to make your project run on a Pioneer Kit:
Connect P2_6 (J3 1) ---- J2 P0_3 (LED Blue) as indicator
P4_0 now input for WAKE (J3 10) since the original pin is only used internally.
Changing WAKE changes the LED from off to on as expected --- No error
Bob
-
4. Re: Anyone know how to read a digital input pin?
JoMe_264151 Mar 13, 2015 3:15 AM (in response to DaHu_285096)Interrupt
Bob
-
iTag.cywrk.Archive011.zip 27.2 K
-
-
5. Re: Anyone know how to read a digital input pin?
DaHu_285096 Mar 13, 2015 4:18 AM (in response to DaHu_285096)Bob,
How did you read the digital inputs? I tried all sorts of combinations an eventually only managed to get them working using the read pins code shown in my last post.
As I do not now have the pin components on the scematic, I am not sure how to set up an interrupt for the pins entirely in firmware?
I presume I need to use some API call to set the pin (say p4.2) as an input and then define an interrupt for it and us ethe startex?
-
6. Re: Anyone know how to read a digital input pin?
JoMe_264151 Mar 13, 2015 4:35 AM (in response to DaHu_285096)I am still working on your problem, but I did not understand yet why you are doing the configuration dynamically and not by setting the properties of the pin component.
Bob
-
7. Re: Anyone know how to read a digital input pin?
ViDv_264506 Mar 13, 2015 4:50 AM (in response to DaHu_285096)Hi Orbitcoms,
please, can you be so kind, can you share - attatch the DataSheet of the AS3393 device?
Viktor
-
8. Re: Anyone know how to read a digital input pin?
JoMe_264151 Mar 13, 2015 4:55 AM (in response to DaHu_285096)Attached latest elaborate. Reading of pins I usually do with the _Read() API which is able to read several pins of a port at once.
Bob
-
9. Re: Anyone know how to read a digital input pin?
JoMe_264151 Mar 13, 2015 4:57 AM (in response to DaHu_285096)Did I say "Attached"?
-
iTag.cywrk.Archive02.zip 27.2 K
-
-
10. Re: Anyone know how to read a digital input pin?
helic_263931 Mar 13, 2015 5:06 AM (in response to DaHu_285096)@bob: yes you did, but your actions did not match your speech :)
-
11. Re: Anyone know how to read a digital input pin?
JoMe_264151 Mar 13, 2015 5:32 AM (in response to DaHu_285096)@hli
My mouse was scared by one of my seven cats ;-))
Bob
-
12. Re: Anyone know how to read a digital input pin?
DaHu_285096 Mar 14, 2015 4:51 PM (in response to DaHu_285096)Bob,
So, for PSCO4 port 4 port pins, you need to read the entire port and then check the pin states of interest. Rather than doing a bitwise read per pin?
ie.
PortState = MYPORT_Read()
if(PortState & 0x01){
//P4.0 is high
}
Then if I want interrupt, I add isr for the entire port and look at which pin caused int in the handler routine? (I want to sleep the device and only wake up on a particulr pin going high).
-
13. Re: Anyone know how to read a digital input pin?
DaKn_263916 Mar 14, 2015 11:12 PM (in response to DaHu_285096)This might help -
http://www.cypress.com/?rID=93401 AN86439 - PSoC® 4 - Using GPIO Pins
http://www.cypress.com/?rID=95069 AN90799 - PSoC® 4 Interrupts
http://www.cypress.com/?rID=38267 AN54460 - PSoC® 3, PSoC 4, and PSoC 5LP Interrupts
Regards, Dana.