PSoC™ 5, 3 & 1 Forum Discussions
I'm trying to modify AN2101 for 16 bit divide.
The 8 bit version works fine but the 16 bit version just give trash.
this is the code, it is in assembly only
;We have [x+0], [x+1], The result will be in dividend+0 A1h ,dividend+1 A2h, ;Lets load the data
div_s_8::
mov [dividend+0],e0h ;we want to div this
mov [dividend+1],01h ;we want to div this
;
mov [divisor+0],02h ;Div by
mov [divisor+1],00h ;Div by 2
;div8:
mov [remainder+0],00h ;initialize remainder to 0
mov [remainder+1],00h ;initialize remainder to 0 New
;New
and F,fbh ;clear carry bit in flags
mov [lcount],16 ;set loop counter to 16 New changed from 8
d8u_1:
rlc [dividend+0] ;shift MSB of dividend to LSB of remainder
rlc [remainder+0] ; continued
rlc [dividend+1] ;shift MSB of dividend to LSB of remainder
rlc [remainder+1] ; continued
;
mov [temp+0],[remainder+0] ;store remainder
mov [temp+1],[remainder+1] ;store remainder New
;
mov a,[remainder+0] ;subtract divisor from remainder
sub a,[divisor+0] ; continued
mov [remainder+0],a ; continued
;New
mov a,[remainder+1] ;subtract divisor from remainder
sub a,[divisor+1] ; continued
mov [remainder+1],a ; continued
jnc d8u_2 ;jump if result was positive
;
mov [remainder+0],[temp+0] ;restore remainder
and [dividend+0],feh ;clear LSB of dividend
;New
mov [remainder+1],[temp+1] ;restore remainder
and [dividend+1],feh ;clear LSB of dividend
;
jmp chkLcount8 ;jump to loop counter decrement
d8u_2:
or [dividend+0],01h ;set dividend LSB to 1
;New
or [dividend+1],01h ;set dividend LSB to 1
;
chkLcount8:
dec [lcount] ;decrement loop counter
jnz d8u_1 ;repeat steps if loop counter not zero
;
ret ;back to caller
;******************************************************************************
Does anyone see the error ?
Thanks
Gord
Show LessThe PSOC1(CY8C27543-24AXI) family has an unprotected (.hex) file. Can I change flash security data to full protection using PSoC Programmer v3.28?
Show LessI have a simple QuadDec module which is connected to a motor encoder. If I now control the motor exactly to the position of the index signal, I have the problem that the processor is constantly stuck in the interrupt CY_ISR( QuadDec_ISR ) (file: QuadDec_INT.c).
I tried to stop the interrupt, but without success:
- QuadDec_isr_Disable(): shows no effect
- QuadDec_isr_Stop(): Code ends in the IntDefaultHandler which is expected.
Can I disable the interrupt? Why don't these APIs work?
Show Lesspsoc creatorにてCY8C5888AXI-LP096に対してプログラムの書き込みを試みたところ、
`this device was recognized, but psoc creator does not support using it at this time.`
と表示され、書き込みができませんでした。
CY8C5888AXI-LP096に対してCY8C5888LTI-LP097向けのプログラムを書き込んでしまった後、
このような状況が続いています。
また、上記を行っていないものに関しては問題なく書き込み可能でした。
Show Less
Hello
I want to ask if there is a way to make a code work interchangeably with another code, I am programming a set of relays, but when these work they prevent me from executing an lm35 sensor and when the relay has already made its cycle, the lm35 starts running.
The cycle is repeated again, the relays work and the reading of lm35 is cut, then, once the relay cycle is completed, the sensor re-read the temperature again.
How can I make the lm35 read to me without being cut when the relays work? that work together without one cut me reading another. It's just code, probe putting functions and the result was the same, the program runs and the sensor does not go at the same time as the relays, they work first and then the lm35
Someone had this experience, how could he solve it.
I attach my program.
Show LessCan you link together basic mailboxes or can you only link together full feature mailboxes?
I recently received a psoc 5 development kit (cy8ckit-059 ). I have attempted to get the uart to usb up and running for debugging and i noticed that the kitProg uController is sending data out the usb port without any input from the target uController. I have scoured the docs and can not find any explanation. Im hoping someone else has had this issue and can provide a solution or give any clues as to why this is happening. A couple notes, if i send data via uart from the target uController to the kitProg then both the real data and the random data are sent out the usb port.
Show LessI heard that CYRF6936 is going to be discontinued? Now the supply is not stable and the price is very high. Are there any other alternatives?
Thanks.
Show LessI am currently working on a project that controls an external device using SPI.
When I attempt to write data to some locations in the external SPI device and read them back, the program locks up in the read routine by jumping to CyPmHviLviRestore()?
Could this be a pointer issue? This is my calling code
void TestSpi(void){
uint8 dataA[20] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
uint8 dataB[20];
dwt_writetodevice(0x21,0, 20,dataA);
dwt_readfromdevice(0x21,0,20,dataB);
asm("nop");
}
The code doing the work is here
int readfromspi(uint16 headerLength, const uint8 *headerBuffer, uint32 readlength, uint8 *readBuffer)
{
int i=0;
volatile uint8 rxbuf[4];
CS_Write(0);
for(i=0; i<headerLength; i++)
{
SPIM_WriteTxData(headerBuffer); //write command to device
while(!(SPIM_ReadTxStatus() & SPIM_STS_SPI_DONE)){}; //wait till sent
readBuffer = SPIM_ReadRxData() ; //read any received data
}
for(i=0; i<(int)readlength; i++)
{
SPIM_WriteTxData(0x00); //dummy write for each byte to read
while(!(SPIM_ReadTxStatus() & SPIM_STS_SPI_DONE)){}; //wait till each byte done
readBuffer = SPIM_ReadRxData();
rxbuf = readBuffer;
}
CS_Write(1);
return 0;
}
Thanks
Show Less