| Author |
Message |
pjc30943
Joined: 02 Dec 2005
|
|
Posted: 22 January 2006, 19:22 PM Post subject: Shift speeds |
|
|
Are there any methods to shifting data faster than the default ShiftinEx speeds? Inline assembly perhaps allowed? In my application, suddenly we have to tx/rx twice the data as before, and now the speeds of ShiftinEx are not sufficient.
The HW SPI port operates fast enough, but in the wrong mode, so hence the shifting instead... |
|
| Back to top |
|
 |
mikep
Joined: 24 Sep 2005
Location: Austin, TX
|
|
Posted: 22 January 2006, 19:35 PM Post subject: |
|
|
It is not possible to put assembler into a ZBasic program. That is not how it is architected. The ZBasic program is compiled into an intermediate form which is then interpreted inside the chip using a Virtual Machine architecture - i.e. similar to Java.
A little more detail on what you are interfacing with might help us give you some meaningful response to your question. What data rate do you need? I assume you tried changing the value of Register.TimerSpeed1 - you can get speeds of 125KHz if I read the Reference Manual correctly. |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Location: Portland, OR
|
|
Posted: 22 January 2006, 20:44 PM Post subject: |
|
|
Both ShiftOutEx() and ShiftInEx() can operate in a "speed controlled" mode or a "non-speed controlled" mode. The mode is selected by bit 2 of the 'flags' parameter. See the manual page for specific information.
In the non-speed controlled mode, the shifting occurs at the fastest possible speed - approximately 2uS per bit or about 500KHz. With speed control, the fastest that you can shift is about 4uS per bit or about 250KHz. Virtually any speed from 4uS per bit up to many seconds per bit can by attained by a combination of the 'bitTime' parameter and the Register.TimerSpeed1 value. It is even possible to use an external signal for the timing by setting Register.TimerSpeed1 to 6 or 7 and using the T1 input (pin 5 on the ZX-24) for the timer clock.
So, as Mike asked, at what speed do you need to shift? |
|
| Back to top |
|
 |
|