embedded systems developers tools, cross compilers
  Home  |   SwiftX Archive  |   SwiftForth Archive  |

Re: Dallas one - wire on avr

From: Matthew Karas <THX1170_at_netscape.net>
Date: Thu, 18 Nov 2004 17:46:03 -0500

Thanks - Seems that using the code from Leon the toggle now takes 500 ns - and a nop can push it out by 250 ns. I'm using SwiftX regular- no optimizer - so thats probably why it was slow when I started out.

Great Stuff - thanks again.
Matthew Karas

PS - when I'm finished writing one wire interface code - would anyone want to see it up on the forth online and interactive site?

"Leon Wagner" <leon_at_forth.com> wrote:

>Definitly write this in assembler. The bit-level I/O instructions (SBI and
>CBI) on the AVR are exactly what you need. Here's all the code needed to
>toggle bit 0 of Port A:
>
>CODE TOGGLE
> 0 PORTA SBI 0 PORTA CBI
> RET END-CODE
>
>Note: There's no "interpreter overhead" inside a SwiftX/AVR definition.
>
>: TOGGLE FF PORTA C! 0 PORTA C! ;
>
>SEE TOGGLE
>
>18F0 FF R16 LDI 0FEF
>18F2 R16 1B OUT 0BBB
>18F4 0 R16 LDI 00E0
>18F6 R16 1B OUT 0BBB
>18F8 RET 0895
>
>The above example is using SwiftX Pro with the code optimizer turned on. If
>you turn off the optimizer (or are using the Lite version which doesn't have
>the code optimizer), you would get this:
>
>18FA (LITERAL) RCALL 8FD3
>18FC LITERAL FF FF00
>18FE (LITERAL) RCALL 8DD3
>1900 LITERAL 3B 3B00
>1902 C! RCALL 88D5
>1904 (LITERAL) RCALL 8AD3
>1906 LITERAL 0 0000
>1908 (LITERAL) RCALL 88D3
>190A LITERAL 3B 3B00
>190C C! RJMP 83C5
>
>As you can see, these literal sequences optimize very nicely on the AVR.
>
>
>
>
>
>> The problem I'm having so far is that the fastest I can toggle a
>> bit with forth on the atmega16 running at 4MHz is only 25 uSec.
>> I need to toggle bits much faster than that. So far the code I'm
>> using looks like
>>
>> :TOGGLE
>> FF PORTA C!
>> 00 PORTA C!
>> ;
>>
>> Is there a divide down for the avr's data bus? Or is the
>> interpreter really taking that long to execute the code?
>>
>> How much faster would
>> :TOGGLE
>> 00 PORTA FF PORTA C! C!
>> ;
>> be?
>>
>> Should I just write these bits in assembler?
>>
>> Thanks,
>> Matthew Karas
>>
>> Frank Boon <fboon_at_runbox.com> wrote:
>>
>> >I am implementing a 1-wire master with a DS2480B, because it can control
>> >the slew-rates.
>> >Not fully implented yet...
>> >
>> >Frank Boon,
>> >Metatronics
>> >
>> >Matthew Karas wrote:
>> >
>> >>Has anyone implemented one wire routines using Atmel's avr318 appnote?
>> >>
>> >>__________________________________________________________________
>> >>Switch to Netscape Internet Service.
>> >>As low as $9.95 a month -- Sign up today at
>> http://isp.netscape.com/register
>> >>
>> >>Netscape. Just the Net You Need.
>> >>
>> >>New! Netscape Toolbar for Internet Explorer
>> >>Search from anywhere on the Web and block those annoying pop-ups.
>> >>Download now at http://channels.netscape.com/ns/search/install.jsp
>> >>----------------------------------------------------------------------
>> >>swiftx_at_forth.com The SwiftX programming discussion email list
>> >>To unsubscribe, send subject "unsubscribe" to swiftx-request_at_forth.com
>> >>For list command help, send subject "help" to swiftx-request_at_forth.com
>> >>Message archives are located at http://www.forth.com/archive/swiftx
>> >>----------------------------------------------------------------------
>> >>This list is a forum for SwiftX users. For product support and bug
>> >>reports, please send email to support_at_forth.com
>> >>----------------------------------------------------------------------
>> >>
>> >>
>> >>
>> >>
>> >
>> >----------------------------------------------------------------------
>> >swiftx_at_forth.com The SwiftX programming discussion email list
>> >To unsubscribe, send subject "unsubscribe" to swiftx-request_at_forth.com
>> >For list command help, send subject "help" to swiftx-request_at_forth.com
>> >Message archives are located at http://www.forth.com/archive/swiftx
>> >----------------------------------------------------------------------
>> >This list is a forum for SwiftX users. For product support and bug
>> >reports, please send email to support_at_forth.com
>> >----------------------------------------------------------------------
>> >
>> >
>>
>>
>> --
>> Why don't you give yourself a nice big
>> round of applause!
>>
>>
>> __________________________________________________________________
>> Switch to Netscape Internet Service.
>> As low as $9.95 a month -- Sign up today at
>> http://isp.netscape.com/register
>>
>> Netscape. Just the Net You Need.
>>
>> New! Netscape Toolbar for Internet Explorer
>> Search from anywhere on the Web and block those annoying pop-ups.
>> Download now at http://channels.netscape.com/ns/search/install.jsp
>> ----------------------------------------------------------------------
>> swiftx_at_forth.com The SwiftX programming discussion email list
>> To unsubscribe, send subject "unsubscribe" to swiftx-request_at_forth.com
>> For list command help, send subject "help" to swiftx-request_at_forth.com
>> Message archives are located at http://www.forth.com/archive/swiftx
>> ----------------------------------------------------------------------
>> This list is a forum for SwiftX users. For product support and bug
>> reports, please send email to support_at_forth.com
>> ----------------------------------------------------------------------
>>
>>
>
>----------------------------------------------------------------------
>swiftx_at_forth.com The SwiftX programming discussion email list
>To unsubscribe, send subject "unsubscribe" to swiftx-request_at_forth.com
>For list command help, send subject "help" to swiftx-request_at_forth.com
>Message archives are located at http://www.forth.com/archive/swiftx
>----------------------------------------------------------------------
>This list is a forum for SwiftX users. For product support and bug
>reports, please send email to support_at_forth.com
>----------------------------------------------------------------------
>
>

-- 
Why don't you give yourself a nice big
round of applause!
__________________________________________________________________
Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register
Netscape. Just the Net You Need.
New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp
----------------------------------------------------------------------
swiftx_at_forth.com          The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe" to swiftx-request_at_forth.com
For list command help, send subject "help" to swiftx-request_at_forth.com
Message archives are located at http://www.forth.com/archive/swiftx
----------------------------------------------------------------------
This list is a forum for SwiftX users.  For product support and bug 
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Thu Nov 18 2004 - 14:46:26 PST

This archive was generated by hypermail 2.2.0 : Thu Nov 20 2008 - 03:04:47 PST