- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I've been stuck with this problem with simple data read-in for a while now, I would appreciate any suggestion:
I write a 3-bit request to an external module, which answers me with 3 bits of data. I checked everything with a scope, the module works properly and answers in 5V binary levels, But, i can't read this data with my CY8C5888AXI-LP096 input pins. I also tried writing mtdat value directrly to other pins, but no luck there either, I must be missing something obvious. Thank you
int n;
int MTMUX0[6]={1, 0, 1, 0, 1, 0}; /* 0bit of six different request codes*/
int MTMUX1[6]={0, 1, 1, 0, 0, 1}; /* 1bit of six different request codes*/
int MTMUX2[6]={0, 0, 0, 1, 1, 1}; /* 2bit of six different request codes*/
int MTDAT0
; /*array of 0bits of module answers*/ int MTDAT1
; int MTDAT2
; for (;;) {
for (n=0; n<6; n++) {
MuxOut0_Write(MTMUX0
); /*write from MTMUX arrays to module*/ MuxOut1_Write(MTMUX1
); MuxOut2_Write(MTMUX2
); CyDelayUs(tdelay); /*delay*/
MTDAT0
=MtDat0_Read(); /*read from module into MTDAT arrays*/ MTDAT1
=MtDat1_Read(); MTDAT2
=MtDat2_Read(); }}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is fixed code, sorry:
int n;
int MTMUX0[6]={1, 0, 1, 0, 1, 0}; /* 0bit of six different request codes*/
int MTMUX1[6]={0, 1, 1, 0, 0, 1}; /* 1bit*/
int MTMUX2[6]={0, 0, 0, 1, 1, 1}; /* 2bit*/
int MTDAT0
int MTDAT1
int MTDAT2
for (;;) {
for (n=0; n<6; n++) {
MuxOut0_Write(MTMUX0
MuxOut1_Write(MTMUX1
MuxOut2_Write(MTMUX2
CyDelayUs(tdelay); /*delay*/
MTDAT0
MTDAT1
MTDAT2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use "Syntax Highlighting" feature on the advanced editor.
int MTDAT0
; /*array of 0bits of module answers*/ int MTDAT1
; int MTDAT2
;
What is the size of the MTDATAx[] array? I thought that the size number in the bracket should not be a variable. Did you see any ERROR when compiling?
Regards,
Noriaki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a mistake of re-writing, in my original code it's size is [6], sorry.
Also, I forgot to mention i already tried Digital Hi-Z configuration.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please confirm followings.
- Are these MtDatX pins assigned to the pin connected to the module output in the CYDWR?
- Is the tdelay value larger than the setup time of the module?
- Is the module has enough hold time? Or add some delay after reading the pin states.
Regards,
Noriaki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. Assignations are correct, 2. t delay is time given for the module to change it's output - the longer the better. 3 This was my best guess too, and I already tried adding delay after read command, but sadly it didn't work either
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please post your complete project so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Some of your scope pictures with correct timing could be very helpful too.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, here is the project.
http://www.filedropper.com/workspace01cywrkarchive01
Also, some details:
Pin_Read() function is not totally dead, it reads the pins somewhat ok, but not in all cycle iterations.
For example, the module gives out:
2- 1 1 1 1 0 0
1- 1 1 0 0 0 0
0- 0 1 0 1 0 0;
And Cypress reads it:
2- 1 0 0 0 0 0
1- 1 0 0 0 0 0
0- 0 1 0 1 0 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content