- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It gives the wrong result. Using PSoC 4, one of the EVM units. Anyone else see it?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
(1) In my previous post my 8bit sample was testing only up to 0x0F for each A, B,
so I fixed them to up to 0xFF but there was no error reported. (comp_test_8bit)
(2) Then I connected 8 x Logic '0 's to B port of DigitalComp, but it caused PSoC Creator to be unable to compile.
Somehow Control_Reg for A ended up to be undefined. (this could be a bug, though...)
(3) Then I re-hired a Control_Reg for B and in the beginning of the program I assigned 0 to Control_Reg for B
and looped A from 0x00 to 0xFF, this is the "case X >= 0" is tested.
And again no error was reported. (comp_test_8bit_op0)
So in general DigitalComp seems to be working.
But just like (2), there may be a combination which causes problem to PSoC Creator.
So your sample project which can re-produce the problem would be appreciated.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you attached a simple project to reproduce the issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I tried some brute force approach.
I created following schematic for CY8CKIT-044
and let PSoC to test all combinations of 4bit A and 4 bit B.
=========================
#include "project.h"
#include <stdio.h>
char str[128] ; /* print buffer */
void print(char *str)
{
UART_UartPutString(str) ;
}
void init_hardware(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
UART_Start() ;
}
int main(void)
{
int a, b, digicmp, expect ;
int error_count = 0 ;
init_hardware() ;
sprintf(str, "DigitalComp Test 4bit (%s %s)\n", __DATE__, __TIME__) ;
print(str) ;
for (b = 0 ; b < 0x10 ; b++ ) {
B_Write(b) ;
for (a = 0 ; a < 0x10 ; a++ ) {
A_Write(a) ;
CyDelay(1) ; /* wait 1ms */
digicmp = DCOUT_Read() ;
expect = (a >= b) ? 1 : 0 ;
sprintf(str, "%02X %02X %d %d ", a, b, digicmp, expect) ;
print(str) ;
if (digicmp == expect) {
print("OK\n") ;
} else {
print("Error!\n") ;
error_count++ ;
}
CyDelay(10) ;
}
}
sprintf(str, "Error Count = %d\n", error_count) ;
print(str) ;
for(;;) {
/* Place your application code here. */
}
}
=========================
The result TeraTerm log was
4bit at the start
4bit at the end
So at least for the 4bit A and B, DigiComp seems to be correct.
Then I tried 8bit, the result was
in this test, I did not let the program print each lines, but Error Count was 0.
So even with 8bit A and B, DigiComp seems to be correct.
BTW, during this test, by mistake I fed 0x00 ~ 0xFF to 4bit A and 4bit B,
there I received a plenty of errors!
So may be you want to check if the bit width of your program and the DigiComp but width are matching.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I created two eight bit control registers and compared them. All was fine but the case where the second was zero.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
By any chance, can you test my comp_test_8bit sample?
It tests all A and B combination including 0 and in my environment no error was reported.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am avoiding use of zero. I will try to test yours. I will also try to retest mine. Perhaps i send you a snippet of logic.
If second operand is zero, should not any operand in first produce true result? It becomes don't care what is in first operand.
Any operand is greater or equal to zero.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
(1) In my previous post my 8bit sample was testing only up to 0x0F for each A, B,
so I fixed them to up to 0xFF but there was no error reported. (comp_test_8bit)
(2) Then I connected 8 x Logic '0 's to B port of DigitalComp, but it caused PSoC Creator to be unable to compile.
Somehow Control_Reg for A ended up to be undefined. (this could be a bug, though...)
(3) Then I re-hired a Control_Reg for B and in the beginning of the program I assigned 0 to Control_Reg for B
and looped A from 0x00 to 0xFF, this is the "case X >= 0" is tested.
And again no error was reported. (comp_test_8bit_op0)
So in general DigitalComp seems to be working.
But just like (2), there may be a combination which causes problem to PSoC Creator.
So your sample project which can re-produce the problem would be appreciated.
moto