That's pretty cool! I've played a bit with digitizing arms from FARO and they are very impressive devices, good luck and please keep as posted on the progress!
/Henrik.
BTW. I think the term is forward kinematics...
That's pretty cool! I've played a bit with digitizing arms from FARO and they are very impressive devices, good luck and please keep as posted on the progress!
/Henrik.
BTW. I think the term is forward kinematics...
Right you are Henrik. Good thing it's just the form title
.
I think I am going to go with the 6 pics reporting to a master via SEROUT2.
I'll have the master report to the pc via HSEROUT. I think the speed will benefit
from this scheme as well.
Chris
Hmm, SEROUT2 (ie software UART) may not be a good idea. The interrupts will screw with the timing. The PIC12F1822 looked perfect for this untill I saw it was listed as a future product... (It's an 8-pin device with USART and Interrupt on change feature). Maby you can use it for the production model ;-)
The PIC16F688, though a 14pin device, is available and has both USART and interrupt on change feature (on 6 pins), have a look at that.
Hey Hendrik,
I'll take a glance at the parts you mentioned. Kinda cool you mentioned the uarts. Maybe you can answer a lingering question for me... In the example of the six "slaves" reporting to the "master"... If I send HSEROUT from the slaves, what would be the protocol for receiving at the master? Would I use SERIN2? What mode? Etc, etc?
That question has driven me nuts for some time!
I'm thinking 20 Mhz on the slaves and 40 Mhz on the master.
What are your thoughts?
Thanks again,
Chris
Hi Chris,
There are varoius ways to do it. You could for example have two wires between each slave and the master PIC. The master signals one slave at a time to to send the current position, and receives it with SERIN or SERIN2. When all 6 slaves are polled it sends the data to the master. The USART sends the data "true" so the master would need to receive it "true".
Another approach is to implement a RS485 network.
/Henrik.
I'll work on a bit of code and we'll see where it takes us...
I'll keep you posted.
Thanks,
Chris
Here's what I've got so far... for the "slave" pics anyhow.
Critiques are definitely welcome!
16F688 w/20Mhz
Thanks again guys,Code:INCLUDE "DT_INTS-14-MOD.bas" INCLUDE "ReEnterPBP.bas" 'Clock setup Define OSC 20 'Pin setups ANSEL = %00000000 'No analog input TRISA = %00000111 'PortA: TRISA = %00XXXXXX TRISC = %00000000 'PortC: TRISC = %00XXXXXX 'Usart setups DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1 DEFINE HSER_CLROERR 1 ' Clear overflow automatically DEFINE HSER_SPBRG 86 ' 57600 Baud @ SPBRGH = 0 BAUDCTL.3 = 1 ' Enable 16 bit baudrate generator '---------------------------------------------------------------------------- MaxCount con 21600 BtnZeroCount var PORTA.0 APin var PORTA.1 BPin var PORTA.2 AOld var byte BOld var byte CurCount var word ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler RAC_INT, _ABInt, PBP, yes endm INT_CREATE ; Creates the interrupt processor INT_ENABLE RAC_INT ; Enable RA change interrupt ENDASM curcount = 0 Start: if btnzerocount = 0 then 'btnzerocount (A.0) has pullup res curcount = 0 endif aold = apin bold = bpin hserout ["$", dec5 curcount] goto start ABInt: '\\\ A caused the interrupt /// IF apin != aold THEN 'APin IS NOT equal to AOld IF apin != bpin THEN 'If A and B are different, GOTO CW 'it was clockwise rotation ELSE 'Otherwise, GOTO CCW 'it was counter-clockwise rotation ENDIF ENDIF '\\\ B caused the interrupt /// IF Bpin != Bold THEN 'BPin IS NOT equal to BOld IF apin == bpin THEN 'If A and B are the same, GOTO CW 'it was clockwise rotation ELSE 'Otherwise, GOTO CCW 'it was counter-clockwise rotation ENDIF ENDIF CW: ' -1 if curcount > 0 then curcount = curcount -1 else curcount = MaxCount endif @ INT_RETURN CCW: ' +1 if curcount < maxcount then curcount = curcount +1 else curcount = 0 endif @ INT_RETURN
Chris
Last edited by kevlar129bp; - 6th January 2010 at 02:22. Reason: Added Pic part#, fixed TRIS reg's...Doh!
Bookmarks