Threaded View
-
24-02-2010 #23
Its easily fast enough in C whan you're running a 20Mhz clock - this scale is running at 74KHz clock rate or 13.5uS.. the actual C routine to sample the clock, determine the falling edge, read the data line and shift it into a 32bit register is 49 assembler instructions (7 lines of C) which takes 9.8uS. It may be that on another scale it will need optimising... although this compiler is pretty good but being C it tends to use temporary variables in RAM (mainly becuase I haven't yet worked out how to force it to use registers as variables)
Code://now in lead up to second data burst unsigned char count=24; long data = 0; while(count>0) { data >>= 1; //prepare for next bit while(CK==1); //wait for clock to go low if(DT==1) //sample data data |= 0x00800000; while(CK==0); //wait for clock to go hi count--; } //do stuff with data...
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Fixing linear rail - DIY practice
By CharlesJenkinson in forum Rails, Guideways & BearingsReplies: 1Last Post: 10-02-2014, 12:53 PM -
NEW MEMBER: Hi from Reading
By Saracen in forum New Member IntroductionsReplies: 4Last Post: 26-11-2012, 01:50 AM -
wall and floor fixing am I the only one ????????????
By luke11cnc in forum General DiscussionReplies: 15Last Post: 30-12-2011, 11:45 PM -
FOR SALE: DRO + 4 Scales
By Rikk in forum Items For SaleReplies: 0Last Post: 22-10-2011, 09:41 AM -
Mill with digital scales
By Robin Hewitt in forum Milling Machines, Builds & ConversionsReplies: 14Last Post: 22-08-2008, 10:21 AM
Bookmarks