Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

Roboard Experience...

Based on DMP's Vortex processor / SoC this board is a full computer capable of running a standard Windows and Linux installation on the backpack of your robot.
95 postsPage 1 of 71, 2, 3, 4, 5 ... 7
95 postsPage 1 of 71, 2, 3, 4, 5 ... 7

Roboard Experience...

Post by PaulL » Tue Dec 29, 2009 12:48 am

Post by PaulL
Tue Dec 29, 2009 12:48 am

I have some information regarding Windows XP and Roboard:

I have set up networking on the Roboard, and have set up a Remote Desktop Connection from my Desktop PC. As an FYI: YOU DO NOT need to have the video card installed to do remote desktop connection, or even to run XP. I have set up an "RDP" file so I can just click it, and voila, into the roboard from my desktop. I also set up file sharing so I can see the Roboard C as "R:" on my desktop, this was done with a username and password.

However, you do not get the normal "Shutdown" / "Reboot" options on the start menu. I have set up two shortcuts on the desktop for this, using the "shutdown.exe" command with a couple command line switches (-f to force close apps, -s to shutdown, -r to reboot, -t 00 to set 0 seconds delay). All I have connected to Roboard right now is power, the RJ45 connection, and a Hitec HSR-8498 Servo. HOW COOL IS THAT??? :) It's VERY useable like this, the speed is just fine. I have more resolution than I could get from the Roboard video card. When I tried higher resolution settings on Roboard, one of my monitors didn't like the signal.

Now, I can write software on my main monitor (I have two on my Desktop PC), and open the remote desktop connection on the other, copy / paste right into the roboard window, share files, etc. VERY cool!!!

I have also been working on the RoboIO.dll source code, getting a better understanding of it. I also know more about C++ than I wish I ever did. ;)

I have played with the demo, and have moved a servo with the demo app under XP.

I know that the board is supposed to be 500mA draw (I haven't slapped my meter on it yet), but what about the video card? Is that WITH the video card?

Something to mention, the CPU can now breathe better, not as hot as it was before.

Paul

Roboard Terminal Window (a bit large, my apologies):

http://robosavvy.com/Builders/RN1AsOf091407/RBScreenShot.JPG
I have some information regarding Windows XP and Roboard:

I have set up networking on the Roboard, and have set up a Remote Desktop Connection from my Desktop PC. As an FYI: YOU DO NOT need to have the video card installed to do remote desktop connection, or even to run XP. I have set up an "RDP" file so I can just click it, and voila, into the roboard from my desktop. I also set up file sharing so I can see the Roboard C as "R:" on my desktop, this was done with a username and password.

However, you do not get the normal "Shutdown" / "Reboot" options on the start menu. I have set up two shortcuts on the desktop for this, using the "shutdown.exe" command with a couple command line switches (-f to force close apps, -s to shutdown, -r to reboot, -t 00 to set 0 seconds delay). All I have connected to Roboard right now is power, the RJ45 connection, and a Hitec HSR-8498 Servo. HOW COOL IS THAT??? :) It's VERY useable like this, the speed is just fine. I have more resolution than I could get from the Roboard video card. When I tried higher resolution settings on Roboard, one of my monitors didn't like the signal.

Now, I can write software on my main monitor (I have two on my Desktop PC), and open the remote desktop connection on the other, copy / paste right into the roboard window, share files, etc. VERY cool!!!

I have also been working on the RoboIO.dll source code, getting a better understanding of it. I also know more about C++ than I wish I ever did. ;)

I have played with the demo, and have moved a servo with the demo app under XP.

I know that the board is supposed to be 500mA draw (I haven't slapped my meter on it yet), but what about the video card? Is that WITH the video card?

Something to mention, the CPU can now breathe better, not as hot as it was before.

Paul

Roboard Terminal Window (a bit large, my apologies):

http://robosavvy.com/Builders/RN1AsOf091407/RBScreenShot.JPG
PaulL
Savvy Roboteer
Savvy Roboteer
Posts: 423
Joined: Sat Sep 15, 2007 12:52 am

Re: Roboard Experience...

Post by Chaosmann » Tue Dec 29, 2009 5:45 am

Post by Chaosmann
Tue Dec 29, 2009 5:45 am

RN1AsOf091407 wrote:... I know that the board is supposed to be 500mA draw (I haven't slapped my meter on it yet), but what about the video card? Is that WITH the video card? ...


Hi,

it's without the video card. With video card it's draw something around 1 - 1.2 A.

Best regards
Daniel
RN1AsOf091407 wrote:... I know that the board is supposed to be 500mA draw (I haven't slapped my meter on it yet), but what about the video card? Is that WITH the video card? ...


Hi,

it's without the video card. With video card it's draw something around 1 - 1.2 A.

Best regards
Daniel
Chaosmann
Robot Builder
Robot Builder
Posts: 16
Joined: Wed Dec 09, 2009 3:43 am

Post by roboard » Tue Dec 29, 2009 10:24 am

Post by roboard
Tue Dec 29, 2009 10:24 am

500mA is without any device loading, but the CPU is full speed.
the VGA chipset is around 1.5A or less.
500mA is without any device loading, but the CPU is full speed.
the VGA chipset is around 1.5A or less.
roboard
Savvy Roboteer
Savvy Roboteer
Posts: 302
Joined: Fri Jul 03, 2009 4:44 am

Post by PaulL » Fri Jan 01, 2010 5:51 am

Post by PaulL
Fri Jan 01, 2010 5:51 am

That's a good draw from the video card alone, that explains why a 6 volt 650mA power supply got quite hot! :)

I've spent a huge amount of time working with WinIO and the RoboIO source, trying to reliably read from the board from .Net. In the end, I've given up on RoboIO and particularly WinIO working with .Net.

I have started using inpout32.dll, and I can, for the first time, reliably read the CPU ID off the board (0x32504d44). It's a lot more straightforward as well, 2 declares versus a handfull of .Net declares and an unmanaged C++ wrapper (RoboIO OR home-brewed) to access WinIO.dll that ultimately loads WinIO.sys. I'd imagine the performance will be better, but I can only get out one WORD per call. Even with that, I think it will be faster. I know the RoboIO source well enough to follow what it's doing to the hardware, so I plan to build most of that functionality up in .Net (where I'm more comfortable).

It's taken a lot of head-banging to get to this point, but I feel it's all downhill from here. :)

I'll post when I have something significant, like servo moves or ADC reads. :) With the 3 day weekend, I should make decent progress.

Paul
That's a good draw from the video card alone, that explains why a 6 volt 650mA power supply got quite hot! :)

I've spent a huge amount of time working with WinIO and the RoboIO source, trying to reliably read from the board from .Net. In the end, I've given up on RoboIO and particularly WinIO working with .Net.

I have started using inpout32.dll, and I can, for the first time, reliably read the CPU ID off the board (0x32504d44). It's a lot more straightforward as well, 2 declares versus a handfull of .Net declares and an unmanaged C++ wrapper (RoboIO OR home-brewed) to access WinIO.dll that ultimately loads WinIO.sys. I'd imagine the performance will be better, but I can only get out one WORD per call. Even with that, I think it will be faster. I know the RoboIO source well enough to follow what it's doing to the hardware, so I plan to build most of that functionality up in .Net (where I'm more comfortable).

It's taken a lot of head-banging to get to this point, but I feel it's all downhill from here. :)

I'll post when I have something significant, like servo moves or ADC reads. :) With the 3 day weekend, I should make decent progress.

Paul
PaulL
Savvy Roboteer
Savvy Roboteer
Posts: 423
Joined: Sat Sep 15, 2007 12:52 am

Post by PaulL » Fri Jan 01, 2010 9:04 pm

Post by PaulL
Fri Jan 01, 2010 9:04 pm

Well, I got WinIO working with .Net. I guess a good night's sleep helps sometimes. :)

The declares were wrong, so here they are if anyone wants them:

Declare Function GetPortVal Lib "WinIo.dll" (ByVal PortAddr As UInt16, ByRef PortVal As UInt32, ByVal bSize As Byte) As Boolean
Declare Function SetPortVal Lib "WinIo.dll" (ByVal PortAddr As UInt16, ByVal PortVal As UInt32, ByVal bSize As Byte) As Boolean
Declare Function InitializeWinIo Lib "WinIo.dll" () As Boolean
Declare Function ShutdownWinIo Lib "WinIo.dll" () As Boolean

And a test to get CPU ID with Rev (replace Form1.Text with a textbox, etc):

Dim val As UInt32

InitializeWinIo()

SetPortVal(&HCF8I, &H80000090UI, 4)
GetPortVal(&HCFCI, val, 4)

Form1.Text = Hex(val)

ShutdownWinIo()

You should get 32504D44 when you run this on the Roboard.

I couldn't get inpout32 to do a real WORD, let alone a DWORD, it always returned just a byte, so I tried a number of different DLL's this morning. There are few that let you write a DWORD. I figured, why not try WinIO again. Now I can just call the port settings right from VB, that should work for now. I'll have to build a C DLL eventually to get the readback from servos, though. The timing is too critical to do in .Net. :)

Paul

(Updated as Unsigned Integers) :)
Well, I got WinIO working with .Net. I guess a good night's sleep helps sometimes. :)

The declares were wrong, so here they are if anyone wants them:

Declare Function GetPortVal Lib "WinIo.dll" (ByVal PortAddr As UInt16, ByRef PortVal As UInt32, ByVal bSize As Byte) As Boolean
Declare Function SetPortVal Lib "WinIo.dll" (ByVal PortAddr As UInt16, ByVal PortVal As UInt32, ByVal bSize As Byte) As Boolean
Declare Function InitializeWinIo Lib "WinIo.dll" () As Boolean
Declare Function ShutdownWinIo Lib "WinIo.dll" () As Boolean

And a test to get CPU ID with Rev (replace Form1.Text with a textbox, etc):

Dim val As UInt32

InitializeWinIo()

SetPortVal(&HCF8I, &H80000090UI, 4)
GetPortVal(&HCFCI, val, 4)

Form1.Text = Hex(val)

ShutdownWinIo()

You should get 32504D44 when you run this on the Roboard.

I couldn't get inpout32 to do a real WORD, let alone a DWORD, it always returned just a byte, so I tried a number of different DLL's this morning. There are few that let you write a DWORD. I figured, why not try WinIO again. Now I can just call the port settings right from VB, that should work for now. I'll have to build a C DLL eventually to get the readback from servos, though. The timing is too critical to do in .Net. :)

Paul

(Updated as Unsigned Integers) :)
Last edited by PaulL on Sat Jan 02, 2010 3:11 pm, edited 2 times in total.
PaulL
Savvy Roboteer
Savvy Roboteer
Posts: 423
Joined: Sat Sep 15, 2007 12:52 am

Do you run XP Pro or Home?

Post by Thex1138 » Sat Jan 02, 2010 8:07 am

Post by Thex1138
Sat Jan 02, 2010 8:07 am

I am also setting up my Roboard...
I have both but if possible i'd prefer to use Win XP Pro, but if XP Home gets by with .Net and the robotics software then that's fine by me.

I was also wondering why I think from RoBoard] it was deemed necessary to have the VGA video card for remote desktop... I agree I thought it wasn't necessary but I bought it anyway assuming it was necessary for robotics sake...
In my my IT day job with engineering software, remoting in to PC's everywhere is done via LAN where my computer does all the display work...
I have 3 PC's on my desk with only one screened whilst the others do labour processing of graphics and rendering...
[I was just noting my bakground so that others would know I have experience with networking [but little with robotic kits javascript:emoticon(':roll:') ]]

Good work you've done!

Cheers
/Rob.Sydney.Australia :D :roll: :roll: :roll:
I am also setting up my Roboard...
I have both but if possible i'd prefer to use Win XP Pro, but if XP Home gets by with .Net and the robotics software then that's fine by me.

I was also wondering why I think from RoBoard] it was deemed necessary to have the VGA video card for remote desktop... I agree I thought it wasn't necessary but I bought it anyway assuming it was necessary for robotics sake...
In my my IT day job with engineering software, remoting in to PC's everywhere is done via LAN where my computer does all the display work...
I have 3 PC's on my desk with only one screened whilst the others do labour processing of graphics and rendering...
[I was just noting my bakground so that others would know I have experience with networking [but little with robotic kits javascript:emoticon(':roll:') ]]

Good work you've done!

Cheers
/Rob.Sydney.Australia :D :roll: :roll: :roll:
Last edited by Thex1138 on Sat Jan 02, 2010 3:29 pm, edited 1 time in total.
Thex1138
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 74
Joined: Sun Dec 06, 2009 1:34 pm
Location: Sydney, Australia

Post by PaulL » Sat Jan 02, 2010 3:07 pm

Post by PaulL
Sat Jan 02, 2010 3:07 pm

Heading off to debug some PWM code... :)

Paul
Heading off to debug some PWM code... :)

Paul
Last edited by PaulL on Sun Jan 01, 2012 9:45 am, edited 1 time in total.
PaulL
Savvy Roboteer
Savvy Roboteer
Posts: 423
Joined: Sat Sep 15, 2007 12:52 am

Debugging Continuous Mode for Servos on Roboard...

Post by PaulL » Sat Jan 02, 2010 5:20 pm

Post by PaulL
Sat Jan 02, 2010 5:20 pm

I just went through comparing the results to the register datasheets. The servo doesn't respond, and I haven't figured out why yet. Maybe someone here can help?

I am simply trying to set a continuous PWM pulse train to set the servo to a position. I have an HSR-8498 connected to S1 on the Roboard. It responds when I run the example app replaying a position capture.

The calls noted below are similar in function to RoboIO's calls. Rd meaning Read, Wr meaning Write, Binary Address, Binary Value, Hex Address, Hex Value. I'm missing something here, what is it?

Thanks,
Paul

(dump of R/W below)

CPUID and Rev:
Wr | Addr: 0000110011111000 Val: 10000000000000000000000010010000 | CF8:80000090
Rd | Addr: 0000110011111100 Val: 00110010010100000100110101000100 | CFC:32504D44
Wr | Addr: 0000110011111000 Val: 10000000000000000000000000001000 | CF8:80000008
Rd | Addr: 0000110011111100 Val: 00000110000000000000000000000001 | CFC:6000001

Setting Default Base Address:
Wr | Addr: 0000110011111000 Val: 10000000000000000011100011010000 | CF8:800038D0
Rd | Addr: 0000110011111100 Val: 00000001100011111111111000000000 | CFC:18FFE00

SetBaseClock:
Wr | Addr: 0000110011111000 Val: 10000000000000000011100011010000 | CF8:800038D0
Rd | Addr: 0000110011111100 Val: 00000001100011111111111000000000 | CFC:18FFE00
Wr | Addr: 0000110011111000 Val: 10000000000000000011100011010000 | CF8:800038D0
Wr | Addr: 0000110011111100 Val: 00000001100011111111111000000000 | CFC:18FFE00

SetIRQ:
Wr | Addr: 0000110011111000 Val: 10000000000000000011100011010000 | CF8:800038D0
Rd | Addr: 0000110011111100 Val: 00000001100011111111111000000000 | CFC:18FFE00
Wr | Addr: 0000110011111000 Val: 10000000000000000011100011010000 | CF8:800038D0
Wr | Addr: 0000110011111100 Val: 00000001100011111111111000000000 | CFC:18FFE00

DisableMultiPWM:
Rd | Addr: 1111111000010100 Val: 11000000000000000000000000000000 | FE14:C0000000
Wr | Addr: 1111111000010100 Val: 01000000000000000000000000000000 | FE14:40000000
Rd | Addr: 1111111000100000 Val: 11000000000000000000000000000000 | FE20:C0000000
Wr | Addr: 1111111000100000 Val: 01000000000000000000000000000000 | FE20:40000000
(Truncated, continues for all ports)

DisableMultiINT:
Rd | Addr: 1111111000000000 Val: 00000000000000000000000000000000 | FE00:0
Wr | Addr: 1111111000000000 Val: 00000000000000000000000000000000 | FE00:0

ClearMultiFlag:
Rd | Addr: 1111111000000100 Val: 00000000000000000000000000000000 | FE04:0
Wr | Addr: 1111111000000100 Val: 11111111111111111111111111111111 | FE04:FFFFFFFF

Begin For Loop (SetCountingMode, SetWaveform, SetPulse, SetPulseCount:
Rd | Addr: 1111111000010100 Val: 01000000000000000000000000000000 | FE14:40000000
Wr | Addr: 1111111000010100 Val: 01000000000000000000000000000000 | FE14:40000000
Rd | Addr: 1111111000010100 Val: 01000000000000000000000000000000 | FE14:40000000
Wr | Addr: 1111111000010100 Val: 01000000000000000000000000000000 | FE14:40000000
Wr | Addr: 1111111000010000 Val: 00000000000000010101010111001100 | FE10:155CC
Wr | Addr: 1111111000001100 Val: 00000000000001100100101101010100 | FE0C:64B54
Rd | Addr: 1111111000010100 Val: 01000000000000000000000000000000 | FE14:40000000
Wr | Addr: 1111111000010100 Val: 01000000000000000000000000000000 | FE14:40000000
Rd | Addr: 1111111000100000 Val: 01000000000000000000000000000000 | FE20:40000000
Wr | Addr: 1111111000100000 Val: 01000000000000000000000000000000 | FE20:40000000
Rd | Addr: 1111111000100000 Val: 01000000000000000000000000000000 | FE20:40000000
Wr | Addr: 1111111000100000 Val: 01000000000000000000000000000000 | FE20:40000000
Wr | Addr: 1111111000011100 Val: 00000000000000010101010111001100 | FE1C:155CC
Wr | Addr: 1111111000011000 Val: 00000000000001100100101101010100 | FE18:64B54
Rd | Addr: 1111111000100000 Val: 01000000000000000000000000000000 | FE20:40000000
Wr | Addr: 1111111000100000 Val: 01000000000000000000000000000000 | FE20:40000000
Rd | Addr: 1111111000101100 Val: 01000000000000000000000000000000 | FE2C:40000000
Wr | Addr: 1111111000101100 Val: 01000000000000000000000000000000 | FE2C:40000000
Rd | Addr: 1111111000101100 Val: 01000000000000000000000000000000 | FE2C:40000000
Wr | Addr: 1111111000101100 Val: 01000000000000000000000000000000 | FE2C:40000000
Wr | Addr: 1111111000101000 Val: 00000000000000010101010111001100 | FE28:155CC
Wr | Addr: 1111111000100100 Val: 00000000000001100100101101010100 | FE24:64B54
Rd | Addr: 1111111000101100 Val: 01000000000000000000000000000000 | FE2C:40000000
Wr | Addr: 1111111000101100 Val: 01000000000000000000000000000000 | FE2C:40000000
(Truncated, continues for all ports)

UnlockMulti:
Rd | Addr: 1111111000001000 Val: 00000000000000000000000000000000 | FE08:0
Wr | Addr: 1111111000001000 Val: 00000000000000000000000000000000 | FE08:0
Rd | Addr: 1111111000010100 Val: 01000000000000000000000000000000 | FE14:40000000
Wr | Addr: 1111111000010100 Val: 11000000000000000000000000000000 | FE14:C0000000
(Truncated, continues for all ports)
I just went through comparing the results to the register datasheets. The servo doesn't respond, and I haven't figured out why yet. Maybe someone here can help?

I am simply trying to set a continuous PWM pulse train to set the servo to a position. I have an HSR-8498 connected to S1 on the Roboard. It responds when I run the example app replaying a position capture.

The calls noted below are similar in function to RoboIO's calls. Rd meaning Read, Wr meaning Write, Binary Address, Binary Value, Hex Address, Hex Value. I'm missing something here, what is it?

Thanks,
Paul

(dump of R/W below)

CPUID and Rev:
Wr | Addr: 0000110011111000 Val: 10000000000000000000000010010000 | CF8:80000090
Rd | Addr: 0000110011111100 Val: 00110010010100000100110101000100 | CFC:32504D44
Wr | Addr: 0000110011111000 Val: 10000000000000000000000000001000 | CF8:80000008
Rd | Addr: 0000110011111100 Val: 00000110000000000000000000000001 | CFC:6000001

Setting Default Base Address:
Wr | Addr: 0000110011111000 Val: 10000000000000000011100011010000 | CF8:800038D0
Rd | Addr: 0000110011111100 Val: 00000001100011111111111000000000 | CFC:18FFE00

SetBaseClock:
Wr | Addr: 0000110011111000 Val: 10000000000000000011100011010000 | CF8:800038D0
Rd | Addr: 0000110011111100 Val: 00000001100011111111111000000000 | CFC:18FFE00
Wr | Addr: 0000110011111000 Val: 10000000000000000011100011010000 | CF8:800038D0
Wr | Addr: 0000110011111100 Val: 00000001100011111111111000000000 | CFC:18FFE00

SetIRQ:
Wr | Addr: 0000110011111000 Val: 10000000000000000011100011010000 | CF8:800038D0
Rd | Addr: 0000110011111100 Val: 00000001100011111111111000000000 | CFC:18FFE00
Wr | Addr: 0000110011111000 Val: 10000000000000000011100011010000 | CF8:800038D0
Wr | Addr: 0000110011111100 Val: 00000001100011111111111000000000 | CFC:18FFE00

DisableMultiPWM:
Rd | Addr: 1111111000010100 Val: 11000000000000000000000000000000 | FE14:C0000000
Wr | Addr: 1111111000010100 Val: 01000000000000000000000000000000 | FE14:40000000
Rd | Addr: 1111111000100000 Val: 11000000000000000000000000000000 | FE20:C0000000
Wr | Addr: 1111111000100000 Val: 01000000000000000000000000000000 | FE20:40000000
(Truncated, continues for all ports)

DisableMultiINT:
Rd | Addr: 1111111000000000 Val: 00000000000000000000000000000000 | FE00:0
Wr | Addr: 1111111000000000 Val: 00000000000000000000000000000000 | FE00:0

ClearMultiFlag:
Rd | Addr: 1111111000000100 Val: 00000000000000000000000000000000 | FE04:0
Wr | Addr: 1111111000000100 Val: 11111111111111111111111111111111 | FE04:FFFFFFFF

Begin For Loop (SetCountingMode, SetWaveform, SetPulse, SetPulseCount:
Rd | Addr: 1111111000010100 Val: 01000000000000000000000000000000 | FE14:40000000
Wr | Addr: 1111111000010100 Val: 01000000000000000000000000000000 | FE14:40000000
Rd | Addr: 1111111000010100 Val: 01000000000000000000000000000000 | FE14:40000000
Wr | Addr: 1111111000010100 Val: 01000000000000000000000000000000 | FE14:40000000
Wr | Addr: 1111111000010000 Val: 00000000000000010101010111001100 | FE10:155CC
Wr | Addr: 1111111000001100 Val: 00000000000001100100101101010100 | FE0C:64B54
Rd | Addr: 1111111000010100 Val: 01000000000000000000000000000000 | FE14:40000000
Wr | Addr: 1111111000010100 Val: 01000000000000000000000000000000 | FE14:40000000
Rd | Addr: 1111111000100000 Val: 01000000000000000000000000000000 | FE20:40000000
Wr | Addr: 1111111000100000 Val: 01000000000000000000000000000000 | FE20:40000000
Rd | Addr: 1111111000100000 Val: 01000000000000000000000000000000 | FE20:40000000
Wr | Addr: 1111111000100000 Val: 01000000000000000000000000000000 | FE20:40000000
Wr | Addr: 1111111000011100 Val: 00000000000000010101010111001100 | FE1C:155CC
Wr | Addr: 1111111000011000 Val: 00000000000001100100101101010100 | FE18:64B54
Rd | Addr: 1111111000100000 Val: 01000000000000000000000000000000 | FE20:40000000
Wr | Addr: 1111111000100000 Val: 01000000000000000000000000000000 | FE20:40000000
Rd | Addr: 1111111000101100 Val: 01000000000000000000000000000000 | FE2C:40000000
Wr | Addr: 1111111000101100 Val: 01000000000000000000000000000000 | FE2C:40000000
Rd | Addr: 1111111000101100 Val: 01000000000000000000000000000000 | FE2C:40000000
Wr | Addr: 1111111000101100 Val: 01000000000000000000000000000000 | FE2C:40000000
Wr | Addr: 1111111000101000 Val: 00000000000000010101010111001100 | FE28:155CC
Wr | Addr: 1111111000100100 Val: 00000000000001100100101101010100 | FE24:64B54
Rd | Addr: 1111111000101100 Val: 01000000000000000000000000000000 | FE2C:40000000
Wr | Addr: 1111111000101100 Val: 01000000000000000000000000000000 | FE2C:40000000
(Truncated, continues for all ports)

UnlockMulti:
Rd | Addr: 1111111000001000 Val: 00000000000000000000000000000000 | FE08:0
Wr | Addr: 1111111000001000 Val: 00000000000000000000000000000000 | FE08:0
Rd | Addr: 1111111000010100 Val: 01000000000000000000000000000000 | FE14:40000000
Wr | Addr: 1111111000010100 Val: 11000000000000000000000000000000 | FE14:C0000000
(Truncated, continues for all ports)
PaulL
Savvy Roboteer
Savvy Roboteer
Posts: 423
Joined: Sat Sep 15, 2007 12:52 am

Roboard does .Net... Or, .Net does Roboard... :)

Post by PaulL » Sat Jan 02, 2010 8:41 pm

Post by PaulL
Sat Jan 02, 2010 8:41 pm

SUCCESS!!! :) a VB.Net application moved a SERVO!!! Wooohooo!!! :)

I missed setting the GPIO control register to PWM in the South Bridge Register:

WriteDWordSB(SBAddresses.SB_GPIOFUNC_REG, &HFFFFFFFFUI)

I can't even begin to say how pumped I am at this very moment. :)

WOOOOOHOOOOO!!! :)

This proves out what I need to do to make it run, now I need to enhance it a bit. :) For the moment, I'm going to throw down some user controls to play with this one servo. ;)

Paul
SUCCESS!!! :) a VB.Net application moved a SERVO!!! Wooohooo!!! :)

I missed setting the GPIO control register to PWM in the South Bridge Register:

WriteDWordSB(SBAddresses.SB_GPIOFUNC_REG, &HFFFFFFFFUI)

I can't even begin to say how pumped I am at this very moment. :)

WOOOOOHOOOOO!!! :)

This proves out what I need to do to make it run, now I need to enhance it a bit. :) For the moment, I'm going to throw down some user controls to play with this one servo. ;)

Paul
PaulL
Savvy Roboteer
Savvy Roboteer
Posts: 423
Joined: Sat Sep 15, 2007 12:52 am

More progress with Visual Studio VB.Net and Roboard...

Post by PaulL » Mon Jan 11, 2010 1:01 am

Post by PaulL
Mon Jan 11, 2010 1:01 am

I've managed to build some sine-wave acceleration / deceleration code, and I have managed to get it to work very smoothly under .Net. At first, I had a problem with pesky XP trying to do things it thought were more important than moving my servo, but I fixed XP's little ego problem. :)

The basic symptom was that the System.Timers.Timer I was using was getting only a "normal" thread priority, and wasn't executing in a timely manner. I involved RDTSC, thinking I could just update the positions based on clock ticks than based on the not-so-exact "whenever I get to it" System.Timers.Timer. However, XP decided other things were important enough to take the CPU away from my app long enough to cause stumbling. My code saw the passing of time, and sped up the acceleration tring to get to its destination when it was supposed to. With the stops and sudden acceration caused by missing time, you can imagine it was pretty ugly whenever XP decided to go do something else.

So, I managed to set the thread priority of my app to "real time", which effectively does exactly what one might think: It locks the .Net app as the sole application getting any CPU time. Beautiful movement, flawless, but at a price: No multitasking during a move. You can quite effectively lock the system up with a code loop. Maybe this should be called "not-so-managed-managed-code".. :)

I may experiment, and find that something higher than "normal", but less than "real time" might work, but it comes back to what needs to be done and how soon.

As a side note, the RoboIO dll does this same thing, setting the thread priority to real time. So, even if I were to use RoboIO instead, I'd be facing the same problem.

I'm hoping I can manage to get the same smoothness with less than real-time thread priority, but there are too many variables to know without testing it out. The other trick is to move more than one servo. I'd like to move all my servos at one shot, with different accelerations and decelerations, that'll be a real test.

As for the movement methodology I'm using at present:

* Time is the main criteria. Start here at this time, end there at that time. Fill in the blanks with a sine-based acceleration or deceleration curve or constant speed.
* Moving from one position to another consists of one or more types of moves. At minimum, this could be acceleration (a punch), deceleration (absorbing an impact), or constant speed (meaning no acceleration, like RN-1 usually moves with the stock board). More normal would be acceleration, then deceleration to get to a position as fast as possible. From here, it's mix and match, whatever is desired.
* Destination can change. Whatever ramp type, or advancing rate for constant speed, will be adjusted when a new value is applied during a move.
* Moves can be interrupted due to sensor or other.

Presently, I'm using an Accel / Decel per move. I'll break apart the functions by sine angle later (basically crossing over 180 degrees on the sine function would be end of move, I just invert the sine from 90 to 270 degrees for acceleration).

If I run out of clock cycles, I'll build more in C++ until I find a good balance. For now, I'm hopeful that I can get .Net to do what I want. :)

Just checked the duration of the code, around 9000 clock ticks (via rdtsc)per loop through the position update code (.Net framework, I didn't expect it to be that good!). That's 9 microseconds at 1 Ghz. For 24 servos, that's 216 microseconds, or .216 milliseconds to update positions on 24 servos, and I haven't even done much to reduce my calculations yet! If, say, 10 mS updates keep the servos running smooth (I'm using continuous mode on the PWM controller, so the pulse train is constant, only gets changed as my app says to), that's only 2.16% of the CPU time utilized purely for updating servo position. Not bad so far! Maybe there's hope, but it might take some interesting tricks to do anything else during that time to keep from interfering with the next position update. ;)

Paul
I've managed to build some sine-wave acceleration / deceleration code, and I have managed to get it to work very smoothly under .Net. At first, I had a problem with pesky XP trying to do things it thought were more important than moving my servo, but I fixed XP's little ego problem. :)

The basic symptom was that the System.Timers.Timer I was using was getting only a "normal" thread priority, and wasn't executing in a timely manner. I involved RDTSC, thinking I could just update the positions based on clock ticks than based on the not-so-exact "whenever I get to it" System.Timers.Timer. However, XP decided other things were important enough to take the CPU away from my app long enough to cause stumbling. My code saw the passing of time, and sped up the acceleration tring to get to its destination when it was supposed to. With the stops and sudden acceration caused by missing time, you can imagine it was pretty ugly whenever XP decided to go do something else.

So, I managed to set the thread priority of my app to "real time", which effectively does exactly what one might think: It locks the .Net app as the sole application getting any CPU time. Beautiful movement, flawless, but at a price: No multitasking during a move. You can quite effectively lock the system up with a code loop. Maybe this should be called "not-so-managed-managed-code".. :)

I may experiment, and find that something higher than "normal", but less than "real time" might work, but it comes back to what needs to be done and how soon.

As a side note, the RoboIO dll does this same thing, setting the thread priority to real time. So, even if I were to use RoboIO instead, I'd be facing the same problem.

I'm hoping I can manage to get the same smoothness with less than real-time thread priority, but there are too many variables to know without testing it out. The other trick is to move more than one servo. I'd like to move all my servos at one shot, with different accelerations and decelerations, that'll be a real test.

As for the movement methodology I'm using at present:

* Time is the main criteria. Start here at this time, end there at that time. Fill in the blanks with a sine-based acceleration or deceleration curve or constant speed.
* Moving from one position to another consists of one or more types of moves. At minimum, this could be acceleration (a punch), deceleration (absorbing an impact), or constant speed (meaning no acceleration, like RN-1 usually moves with the stock board). More normal would be acceleration, then deceleration to get to a position as fast as possible. From here, it's mix and match, whatever is desired.
* Destination can change. Whatever ramp type, or advancing rate for constant speed, will be adjusted when a new value is applied during a move.
* Moves can be interrupted due to sensor or other.

Presently, I'm using an Accel / Decel per move. I'll break apart the functions by sine angle later (basically crossing over 180 degrees on the sine function would be end of move, I just invert the sine from 90 to 270 degrees for acceleration).

If I run out of clock cycles, I'll build more in C++ until I find a good balance. For now, I'm hopeful that I can get .Net to do what I want. :)

Just checked the duration of the code, around 9000 clock ticks (via rdtsc)per loop through the position update code (.Net framework, I didn't expect it to be that good!). That's 9 microseconds at 1 Ghz. For 24 servos, that's 216 microseconds, or .216 milliseconds to update positions on 24 servos, and I haven't even done much to reduce my calculations yet! If, say, 10 mS updates keep the servos running smooth (I'm using continuous mode on the PWM controller, so the pulse train is constant, only gets changed as my app says to), that's only 2.16% of the CPU time utilized purely for updating servo position. Not bad so far! Maybe there's hope, but it might take some interesting tricks to do anything else during that time to keep from interfering with the next position update. ;)

Paul
PaulL
Savvy Roboteer
Savvy Roboteer
Posts: 423
Joined: Sat Sep 15, 2007 12:52 am

Roboard DotNet Servo Movement Video...

Post by PaulL » Mon Jan 11, 2010 2:42 am

Post by PaulL
Mon Jan 11, 2010 2:42 am

I have a video of the motion in action, notice no jerky motions, stop is smooth at each end point. I don't have a pause at an endpoint in the video, but you can see the accel / decel. Each pass, left to right, right to left, is another move.

This is, again, done from a VB.Net "WinForms" application, with calls to a RDTSC DLL for calculating percentage of duration through the move, and accessing the IO via WinIO.dll.

That bright glaring area mid right is the Roboard. :)

http://www.mytrackwork.com/RoboardDotNet.avi

Thoughts / Opinions?

Thanks,
Paul
I have a video of the motion in action, notice no jerky motions, stop is smooth at each end point. I don't have a pause at an endpoint in the video, but you can see the accel / decel. Each pass, left to right, right to left, is another move.

This is, again, done from a VB.Net "WinForms" application, with calls to a RDTSC DLL for calculating percentage of duration through the move, and accessing the IO via WinIO.dll.

That bright glaring area mid right is the Roboard. :)

http://www.mytrackwork.com/RoboardDotNet.avi

Thoughts / Opinions?

Thanks,
Paul
PaulL
Savvy Roboteer
Savvy Roboteer
Posts: 423
Joined: Sat Sep 15, 2007 12:52 am

Post by Chaosmann » Mon Jan 11, 2010 7:22 am

Post by Chaosmann
Mon Jan 11, 2010 7:22 am

I can not open the video, unfortunately. The file also has just 850 kb.
To make your transpose to other fun and interesting, it would be good, to implement the group movement function of the SSC.

Just my 2 cents

Daniel
I can not open the video, unfortunately. The file also has just 850 kb.
To make your transpose to other fun and interesting, it would be good, to implement the group movement function of the SSC.

Just my 2 cents

Daniel
Chaosmann
Robot Builder
Robot Builder
Posts: 16
Joined: Wed Dec 09, 2009 3:43 am

Post by PaulL » Thu Jan 14, 2010 11:59 am

Post by PaulL
Thu Jan 14, 2010 11:59 am

The video uses an Indeo codec, nothing fancy or odd. Maybe try saving to your desktop and opening from there? It's a small file because I initially shortened it to upload it to Robosavvy, but they block video file extensions, so I threw it on some webspace. I have bigger files, this one just shows an arm movement with one servo.

I am not familiar with the group movement function of SSC, but I do intend to set up group moves. A further note, the motion code I'm writing allows me to change the end point during motion or change the end time of a motion, so I can adapt to changes while moving (think synchronized dance moves). I will end up building a manager class for servos that will include group movement functions once I have the servo code object nailed down.
The video uses an Indeo codec, nothing fancy or odd. Maybe try saving to your desktop and opening from there? It's a small file because I initially shortened it to upload it to Robosavvy, but they block video file extensions, so I threw it on some webspace. I have bigger files, this one just shows an arm movement with one servo.

I am not familiar with the group movement function of SSC, but I do intend to set up group moves. A further note, the motion code I'm writing allows me to change the end point during motion or change the end time of a motion, so I can adapt to changes while moving (think synchronized dance moves). I will end up building a manager class for servos that will include group movement functions once I have the servo code object nailed down.
PaulL
Savvy Roboteer
Savvy Roboteer
Posts: 423
Joined: Sat Sep 15, 2007 12:52 am

Post by PaulL » Tue Jan 19, 2010 2:22 am

Post by PaulL
Tue Jan 19, 2010 2:22 am

I didn't do an update for this past weekend. So, here goes:

Found a problem with my Servo move code using the Sine function. It's quite obvious in retrospect. In summary, it works, as long as you are doing an "end to end" move with Accel and Decel. Anything else (accel to x, decel to other x) will result in a problematic motion curve, which can be seen as a "point" on the motion pulses when graphed in Excel.

I started researching to find what I should do regarding acceleration of motion, ended up in calculus, with the motion / velocity / acceleration formula. In the end, this code works, but it's processor heavy, and there are some "characteristics" regarding velocity that make this method less than appealing. For example, two consecutive moves produce a nice Accel / Decel curve, as long as the periods of each are equal. Once you start to alter the periods, you end up with overshoot and undershoot curves to end at the final desired position. I ended up generating some nice oscillatory graphs of motion, but I don't think my RN-1 would be happy waving his limbs around madly searching for his target position. :) This code works, but it has drawbacks. The curve can be made to behave, but it's not as intuitive as I would like. ;)

So, a sine function-based algorithm works for a defined start and end, and the calculus-based Accel / Velocity / Position method works for a defined start and end and more if you're patient in setting up moves. The AVP method (reference to the movie unintentional) shows promise, but I'm not ready to move servos with it without enhancing a UI for it (though, I did go so far as to graph the motions in the Roboard app).

Getting impatient, I decided to build a "move at this speed, start here, end here" method that I call "Linear Motion". No accel / decel, this function mimics the stock behavior of the RN-1 (easy code, really light CPU loading). Realizing that Start here, End there, go at this speed, is the stock means of motion on the RN-1, I figured I should re-acquaint myself with the MRC-3024 to see if I could actually pull out the position data and reuse it with the Roboard (lots of good, useful position data there!). Since I last programmed him, I have a new PC. It has NO serial ports, and I don't have any USB to Serial adapters. To add to that, I have misplaced my programming cable. I built a new one, and installed the Robonova software on the Roboard. There's a sight, seeing the Roboard tethered to the MRC-3024, and moving a single servo using the RoboBasic application over Remote Desktop via ethernet into the Roboard.

I went through the exercise of dumping the source code for the RN-1 into a spreadsheet, and built a few VBA parsing functions to put the G6A, G6D, etc moves into a consistent 1 -> 24 servo format, giving each "set" of positions a name corresponding to the source code function. In the end, I pulled some ~180 positions out of the default RoboNova program code and dropped them into a .csv file. I figured that these motions are already figured out, and I will scale the values and alter the servo directions such that I can use the Roboard to synthesize his stock moves, using the 10 to 190 values scaled to actual PWM durations. That should get him walking a bit more soon than anticipated, and fulfills one of my goals of having him be able to perform all of his stock moves with the Roboard. Yes, I did think about integrating the MRC-3024 WITH the Roboard for use in my RN-1, for about .32 seconds. ;)

I went even farther than that, and have built a servo manager class that invokes servo objects to perform the moves, using the MM Timer calls I found (better than other available timers, in .Net, or in C++, etc, under XP). His moves themselves, however, will be based on RDTSC, CPU Clock Ticks. I will be using the MM Timer to invoke servo position updates, but use CPU Clock Ticks to calculate the actual intended position. I believe this is the most smooth method I can utilize to get smooth motion under XP. And, I can back off the MM Timer as needed (as I can stand, until his motions become jerky) to free up some CPU for other activities. Part of the reason for this is that MM Timer Elapsed events are relentless. If interrupted, they will queue, and execute one after another once enough CPU cycles are available again. I may build a method to prevent that from happening, but all the same, the timer CAN be interrupted, meaning it should not be used as "the" time base for calculating positions, but I will use it for updates to positions, as it is the best timer that can be found under XP. ;)

Right now, I have to debug some code, and chart some graphs in Excel to prove out the motion conversions before I rack some servos with it. I have his legs and stock board pulled, so he can't exactly get up and walk around just yet. Add to that, I bought a blue bracket set for him, along with an I2C Compass, an Accelerometer (bought when I picked up the Roboard), and a set of Grippers. Ultimately, I'd like to build some "Melissa" hands for him, but they have to be able to be used for cartwheels. One thing that frustrates me with Hitec- they release the bracket kits, then only sell the "gold / orange" grippers. I researched removing anodizing and home-brewed anodizing processes today. ;) The best thing about the gripper kit is the cost of the HSR-8498's in the kit- more to buy them separately than buy them in this kit w/ gripper brackets. Go figure! :) I doubt I'll change the color of the grippers, as with the vision of "Melissa" hands stuck in my head, they won't be around for long, not long enough to test color-matching to the Blue bracket set. :)

I have to say though, I am tempted to put his legs back on and fashion some makeshift mounting for the Roboard to test out this code. If I can have him do stock moves of 16 servos with the Roboard smoothly under XP, I'll be quite a happy camper. :)

A note about Roboard on the RN-1: It doesn't quite fit. You have to mount it high to correspond to the angles on the aluminum below the arms on the backplate, which puts the board up to the height of the slotted tabs on the top plate of his torso. He will need some protection and mounting holes, so I will take his stock back plate and cut it about .250 inches down his back, and use that angle bracket for Roboard mounting and protection when flipped upward on the new bracket set. That piece will either be re-anodized, or spray painted. I have also been thinking about a Roboard "Roll Cage". I will definitely be ditching the stock chest and back plate, they just don't fit. I was thinking of thermoforming a shell for front and back, but he needs some reinforcement for falls and tumbles (roll cage). I intend to integrate the new body with the antenna for a VT6655 WiFi card I purchased such that the antenna doesn't interfere with his acrobatics. That should be interesting... :)

As this code matures, I will be integrating what I've learned, providing the Sine and AVP type motions along with the Linear Motion functions. Right now, I have to say, I am curious about what the AVP accel / sustain / decel motions would look like with the stock moves. :)

In case anyone was wondering, once I have enough code to be of use, yes, I do intend to post it for any / all to use. :)

Once I have him moving again, my focus for coding will be on I2C, SPI, and the ADC. I also intend to create a "raw" document for how to talk directly with the hardware as I have been doing. ;)

The joke around the house I have right now is, if I can get him to walk and talk at the same time, I'll be happy... (enter XP Speech which I have incorporated already) I hope the 1ghz CPU can do that under XP.... I hope. ;)

Take Care,
Paul
I didn't do an update for this past weekend. So, here goes:

Found a problem with my Servo move code using the Sine function. It's quite obvious in retrospect. In summary, it works, as long as you are doing an "end to end" move with Accel and Decel. Anything else (accel to x, decel to other x) will result in a problematic motion curve, which can be seen as a "point" on the motion pulses when graphed in Excel.

I started researching to find what I should do regarding acceleration of motion, ended up in calculus, with the motion / velocity / acceleration formula. In the end, this code works, but it's processor heavy, and there are some "characteristics" regarding velocity that make this method less than appealing. For example, two consecutive moves produce a nice Accel / Decel curve, as long as the periods of each are equal. Once you start to alter the periods, you end up with overshoot and undershoot curves to end at the final desired position. I ended up generating some nice oscillatory graphs of motion, but I don't think my RN-1 would be happy waving his limbs around madly searching for his target position. :) This code works, but it has drawbacks. The curve can be made to behave, but it's not as intuitive as I would like. ;)

So, a sine function-based algorithm works for a defined start and end, and the calculus-based Accel / Velocity / Position method works for a defined start and end and more if you're patient in setting up moves. The AVP method (reference to the movie unintentional) shows promise, but I'm not ready to move servos with it without enhancing a UI for it (though, I did go so far as to graph the motions in the Roboard app).

Getting impatient, I decided to build a "move at this speed, start here, end here" method that I call "Linear Motion". No accel / decel, this function mimics the stock behavior of the RN-1 (easy code, really light CPU loading). Realizing that Start here, End there, go at this speed, is the stock means of motion on the RN-1, I figured I should re-acquaint myself with the MRC-3024 to see if I could actually pull out the position data and reuse it with the Roboard (lots of good, useful position data there!). Since I last programmed him, I have a new PC. It has NO serial ports, and I don't have any USB to Serial adapters. To add to that, I have misplaced my programming cable. I built a new one, and installed the Robonova software on the Roboard. There's a sight, seeing the Roboard tethered to the MRC-3024, and moving a single servo using the RoboBasic application over Remote Desktop via ethernet into the Roboard.

I went through the exercise of dumping the source code for the RN-1 into a spreadsheet, and built a few VBA parsing functions to put the G6A, G6D, etc moves into a consistent 1 -> 24 servo format, giving each "set" of positions a name corresponding to the source code function. In the end, I pulled some ~180 positions out of the default RoboNova program code and dropped them into a .csv file. I figured that these motions are already figured out, and I will scale the values and alter the servo directions such that I can use the Roboard to synthesize his stock moves, using the 10 to 190 values scaled to actual PWM durations. That should get him walking a bit more soon than anticipated, and fulfills one of my goals of having him be able to perform all of his stock moves with the Roboard. Yes, I did think about integrating the MRC-3024 WITH the Roboard for use in my RN-1, for about .32 seconds. ;)

I went even farther than that, and have built a servo manager class that invokes servo objects to perform the moves, using the MM Timer calls I found (better than other available timers, in .Net, or in C++, etc, under XP). His moves themselves, however, will be based on RDTSC, CPU Clock Ticks. I will be using the MM Timer to invoke servo position updates, but use CPU Clock Ticks to calculate the actual intended position. I believe this is the most smooth method I can utilize to get smooth motion under XP. And, I can back off the MM Timer as needed (as I can stand, until his motions become jerky) to free up some CPU for other activities. Part of the reason for this is that MM Timer Elapsed events are relentless. If interrupted, they will queue, and execute one after another once enough CPU cycles are available again. I may build a method to prevent that from happening, but all the same, the timer CAN be interrupted, meaning it should not be used as "the" time base for calculating positions, but I will use it for updates to positions, as it is the best timer that can be found under XP. ;)

Right now, I have to debug some code, and chart some graphs in Excel to prove out the motion conversions before I rack some servos with it. I have his legs and stock board pulled, so he can't exactly get up and walk around just yet. Add to that, I bought a blue bracket set for him, along with an I2C Compass, an Accelerometer (bought when I picked up the Roboard), and a set of Grippers. Ultimately, I'd like to build some "Melissa" hands for him, but they have to be able to be used for cartwheels. One thing that frustrates me with Hitec- they release the bracket kits, then only sell the "gold / orange" grippers. I researched removing anodizing and home-brewed anodizing processes today. ;) The best thing about the gripper kit is the cost of the HSR-8498's in the kit- more to buy them separately than buy them in this kit w/ gripper brackets. Go figure! :) I doubt I'll change the color of the grippers, as with the vision of "Melissa" hands stuck in my head, they won't be around for long, not long enough to test color-matching to the Blue bracket set. :)

I have to say though, I am tempted to put his legs back on and fashion some makeshift mounting for the Roboard to test out this code. If I can have him do stock moves of 16 servos with the Roboard smoothly under XP, I'll be quite a happy camper. :)

A note about Roboard on the RN-1: It doesn't quite fit. You have to mount it high to correspond to the angles on the aluminum below the arms on the backplate, which puts the board up to the height of the slotted tabs on the top plate of his torso. He will need some protection and mounting holes, so I will take his stock back plate and cut it about .250 inches down his back, and use that angle bracket for Roboard mounting and protection when flipped upward on the new bracket set. That piece will either be re-anodized, or spray painted. I have also been thinking about a Roboard "Roll Cage". I will definitely be ditching the stock chest and back plate, they just don't fit. I was thinking of thermoforming a shell for front and back, but he needs some reinforcement for falls and tumbles (roll cage). I intend to integrate the new body with the antenna for a VT6655 WiFi card I purchased such that the antenna doesn't interfere with his acrobatics. That should be interesting... :)

As this code matures, I will be integrating what I've learned, providing the Sine and AVP type motions along with the Linear Motion functions. Right now, I have to say, I am curious about what the AVP accel / sustain / decel motions would look like with the stock moves. :)

In case anyone was wondering, once I have enough code to be of use, yes, I do intend to post it for any / all to use. :)

Once I have him moving again, my focus for coding will be on I2C, SPI, and the ADC. I also intend to create a "raw" document for how to talk directly with the hardware as I have been doing. ;)

The joke around the house I have right now is, if I can get him to walk and talk at the same time, I'll be happy... (enter XP Speech which I have incorporated already) I hope the 1ghz CPU can do that under XP.... I hope. ;)

Take Care,
Paul
PaulL
Savvy Roboteer
Savvy Roboteer
Posts: 423
Joined: Sat Sep 15, 2007 12:52 am

Roboard IO via VB.Net

Post by PaulL » Tue Jan 19, 2010 3:07 am

Post by PaulL
Tue Jan 19, 2010 3:07 am

I can't upload a .txt file, let alone a .vb file, so I figured I'd just post it. Below is an excerpt from my IO code in case anyone is interested (note, the C code is commented out inline to see what the RoboIO code looked like:

Code: Select all
Public Module IO

#Region "WinIO Declares"

    Declare Function GetPortVal Lib "WinIo.dll" (ByVal PortAddr As UInt16, ByRef PortVal As UInt32, ByVal bSize As Byte) As Boolean
    Declare Function SetPortVal Lib "WinIo.dll" (ByVal PortAddr As UInt16, ByVal PortVal As UInt32, ByVal bSize As Byte) As Boolean
    Declare Function InitializeWinIo Lib "WinIo.dll" () As Boolean
    Declare Function ShutdownWinIo Lib "WinIo.dll" () As Boolean

#End Region

#Region "General Read / Write Instructions"

    Public Function ReadByte(ByVal Address As UInt16) As Byte
        Dim val As UInt32
        GetPortVal(Address, val, 1)
        Return CByte(val)
    End Function

    Public Function ReadWord(ByVal Address As UInt16) As UInt16
        Dim val As UInt32
        GetPortVal(Address, val, 2)
        Return CUShort(val)
    End Function

    Public Function ReadDWord(ByVal Address As UInt16) As UInt32
        Dim val As UInt32
        GetPortVal(Address, val, 4)
        Return val
    End Function

    Public Sub WriteByte(ByVal Address As UInt16, ByVal Val As Byte)
        SetPortVal(Address, Val, 1)
    End Sub

    Public Sub WriteWord(ByVal Address As UInt16, ByVal Val As UInt16)
        SetPortVal(Address, Val, 1)
    End Sub

    Public Sub WriteDWord(ByVal Address As UInt16, ByVal Val As UInt32)
        SetPortVal(Address, Val, 4)
    End Sub

#End Region

    Public Enum SB As Byte
        PWMSETTING_REG = &HD0UI
        GPIOFUNC_REG = &HC8UI
        MULTIFUNC_REG = &HC0UI
    End Enum

    Public Enum NB As Byte
        CPUID_REG = &H90UI
        REVID_REG = &H8UI
    End Enum

#Region "South Bridge Read / Write Instructions"

    '// read south bridge register
    Public Function ReadByteSB(ByVal Address As SB) As Byte
        'RB_INLINE RBAPI(unsigned char) read_sb_regb(unsigned char idx) {
        ' io_outpdw(0x0cf8, (0x80003800L+(unsigned long)idx) & 0xfffffffcL);
        '    return 0xff & (unsigned char)(io_inpdw(0x0cfc) >> ((idx & 0x03) * 8));
        '}
        WriteDWord(&HCF8UI, (&H80003800UI + Address) And &HFFFFFFFCUI)
        Return CByte(&HFFUI And (ReadDWord(&HCFCUI) >> ((Address And &H3US)) * 8))
    End Function

    Public Function ReadDWordSB(ByVal Address As SB) As UInt32
        'RB_INLINE RBAPI(unsigned long) read_sb_reg(unsigned char idx) {
        ' io_outpdw(0x0cf8, (0x80003800L+(unsigned long)idx) & 0xfffffffcL);
        '    return io_inpdw(0x0cfc);
        '}
        '10000000000000000011100000000000
        WriteDWord(&HCF8UI, (&H80003800UI + Address) And &HFFFFFFFCUI)
        Return ReadDWord(&HCFCUI)
    End Function

    '// write south bridge register
    Public Sub WriteByteSB(ByVal Address As SB, ByVal Val As Byte)
        'RB_INLINE RBAPI(void) write_sb_regb(unsigned char idx, unsigned char val) {
        ' int i = (idx & 0x03) * 8;

        ' io_outpdw(0x0cf8, (0x80003800L+(unsigned long)idx) & 0xfffffffcL);
        ' io_outpdw(0x0cfc, (io_inpdw(0x0cfc) & (~(0x000000ffL << i))) | ((unsigned long)val <[i]> ((Address And &H3US) * 8)))
    End Function

    Public Function ReadDWordNB(ByVal Address As NB) As UInt32
        'RB_INLINE RBAPI(unsigned long) read_nb_reg(unsigned char idx) {
        ' io_outpdw(0x0cf8, (0x80000000L+(unsigned long)idx) & 0xfffffffcL);
        '    return io_inpdw(0x0cfc);
        '}
        WriteDWord(&HCF8UI, (&H80000000UI + Address) And &HFFFFFFFCUI)
        Return ReadDWord(&HCFCUI)
    End Function

    '// write north bridge register
    Public Sub WriteByteNB(ByVal Address As NB, ByVal Val As Byte)
        'RB_INLINE RBAPI(void) write_nb_regb(unsigned char idx, unsigned char val) {
        ' int i = (idx & 0x03) * 8;
        ' io_outpdw(0x0cf8, (0x80000000L+(unsigned long)idx) & 0xfffffffcL);
        ' io_outpdw(0x0cfc, (io_inpdw(0x0cfc) & (~(0x000000ffL << i))) | ((unsigned long)val << i));
        '}
        Dim i As Int32 = (CInt(Address) And &H3I) * 8I
        WriteDWord(&HCF8UI, (&H80000000UI + Address) And &HFFFFFFFCUI)
        WriteDWord(&HCFCUI, (ReadDWord(&HCFCUI) And (Not (&HFFUI << i))) Or (CUShort(Val) << i))
    End Sub

    Public Sub WriteDWordNB(ByVal Address As NB, ByVal val As UInt32)
        'RB_INLINE RBAPI(void) write_nb_reg(unsigned char idx, unsigned long val) {
        ' io_outpdw(0x0cf8, (0x80000000L+(unsigned long)idx) & 0xfffffffcL);
        ' io_outpdw(0x0cfc, val);
        ' }
        WriteDWord(&HCF8UI, (&H80000000UI + Address) And &HFFFFFFFCUI)
        WriteDWord(&HCFCUI, val)
    End Sub

#End Region

End Module
I can't upload a .txt file, let alone a .vb file, so I figured I'd just post it. Below is an excerpt from my IO code in case anyone is interested (note, the C code is commented out inline to see what the RoboIO code looked like:

Code: Select all
Public Module IO

#Region "WinIO Declares"

    Declare Function GetPortVal Lib "WinIo.dll" (ByVal PortAddr As UInt16, ByRef PortVal As UInt32, ByVal bSize As Byte) As Boolean
    Declare Function SetPortVal Lib "WinIo.dll" (ByVal PortAddr As UInt16, ByVal PortVal As UInt32, ByVal bSize As Byte) As Boolean
    Declare Function InitializeWinIo Lib "WinIo.dll" () As Boolean
    Declare Function ShutdownWinIo Lib "WinIo.dll" () As Boolean

#End Region

#Region "General Read / Write Instructions"

    Public Function ReadByte(ByVal Address As UInt16) As Byte
        Dim val As UInt32
        GetPortVal(Address, val, 1)
        Return CByte(val)
    End Function

    Public Function ReadWord(ByVal Address As UInt16) As UInt16
        Dim val As UInt32
        GetPortVal(Address, val, 2)
        Return CUShort(val)
    End Function

    Public Function ReadDWord(ByVal Address As UInt16) As UInt32
        Dim val As UInt32
        GetPortVal(Address, val, 4)
        Return val
    End Function

    Public Sub WriteByte(ByVal Address As UInt16, ByVal Val As Byte)
        SetPortVal(Address, Val, 1)
    End Sub

    Public Sub WriteWord(ByVal Address As UInt16, ByVal Val As UInt16)
        SetPortVal(Address, Val, 1)
    End Sub

    Public Sub WriteDWord(ByVal Address As UInt16, ByVal Val As UInt32)
        SetPortVal(Address, Val, 4)
    End Sub

#End Region

    Public Enum SB As Byte
        PWMSETTING_REG = &HD0UI
        GPIOFUNC_REG = &HC8UI
        MULTIFUNC_REG = &HC0UI
    End Enum

    Public Enum NB As Byte
        CPUID_REG = &H90UI
        REVID_REG = &H8UI
    End Enum

#Region "South Bridge Read / Write Instructions"

    '// read south bridge register
    Public Function ReadByteSB(ByVal Address As SB) As Byte
        'RB_INLINE RBAPI(unsigned char) read_sb_regb(unsigned char idx) {
        ' io_outpdw(0x0cf8, (0x80003800L+(unsigned long)idx) & 0xfffffffcL);
        '    return 0xff & (unsigned char)(io_inpdw(0x0cfc) >> ((idx & 0x03) * 8));
        '}
        WriteDWord(&HCF8UI, (&H80003800UI + Address) And &HFFFFFFFCUI)
        Return CByte(&HFFUI And (ReadDWord(&HCFCUI) >> ((Address And &H3US)) * 8))
    End Function

    Public Function ReadDWordSB(ByVal Address As SB) As UInt32
        'RB_INLINE RBAPI(unsigned long) read_sb_reg(unsigned char idx) {
        ' io_outpdw(0x0cf8, (0x80003800L+(unsigned long)idx) & 0xfffffffcL);
        '    return io_inpdw(0x0cfc);
        '}
        '10000000000000000011100000000000
        WriteDWord(&HCF8UI, (&H80003800UI + Address) And &HFFFFFFFCUI)
        Return ReadDWord(&HCFCUI)
    End Function

    '// write south bridge register
    Public Sub WriteByteSB(ByVal Address As SB, ByVal Val As Byte)
        'RB_INLINE RBAPI(void) write_sb_regb(unsigned char idx, unsigned char val) {
        ' int i = (idx & 0x03) * 8;

        ' io_outpdw(0x0cf8, (0x80003800L+(unsigned long)idx) & 0xfffffffcL);
        ' io_outpdw(0x0cfc, (io_inpdw(0x0cfc) & (~(0x000000ffL << i))) | ((unsigned long)val <[i]> ((Address And &H3US) * 8)))
    End Function

    Public Function ReadDWordNB(ByVal Address As NB) As UInt32
        'RB_INLINE RBAPI(unsigned long) read_nb_reg(unsigned char idx) {
        ' io_outpdw(0x0cf8, (0x80000000L+(unsigned long)idx) & 0xfffffffcL);
        '    return io_inpdw(0x0cfc);
        '}
        WriteDWord(&HCF8UI, (&H80000000UI + Address) And &HFFFFFFFCUI)
        Return ReadDWord(&HCFCUI)
    End Function

    '// write north bridge register
    Public Sub WriteByteNB(ByVal Address As NB, ByVal Val As Byte)
        'RB_INLINE RBAPI(void) write_nb_regb(unsigned char idx, unsigned char val) {
        ' int i = (idx & 0x03) * 8;
        ' io_outpdw(0x0cf8, (0x80000000L+(unsigned long)idx) & 0xfffffffcL);
        ' io_outpdw(0x0cfc, (io_inpdw(0x0cfc) & (~(0x000000ffL << i))) | ((unsigned long)val << i));
        '}
        Dim i As Int32 = (CInt(Address) And &H3I) * 8I
        WriteDWord(&HCF8UI, (&H80000000UI + Address) And &HFFFFFFFCUI)
        WriteDWord(&HCFCUI, (ReadDWord(&HCFCUI) And (Not (&HFFUI << i))) Or (CUShort(Val) << i))
    End Sub

    Public Sub WriteDWordNB(ByVal Address As NB, ByVal val As UInt32)
        'RB_INLINE RBAPI(void) write_nb_reg(unsigned char idx, unsigned long val) {
        ' io_outpdw(0x0cf8, (0x80000000L+(unsigned long)idx) & 0xfffffffcL);
        ' io_outpdw(0x0cfc, val);
        ' }
        WriteDWord(&HCF8UI, (&H80000000UI + Address) And &HFFFFFFFCUI)
        WriteDWord(&HCFCUI, val)
    End Sub

#End Region

End Module
PaulL
Savvy Roboteer
Savvy Roboteer
Posts: 423
Joined: Sat Sep 15, 2007 12:52 am

Next
95 postsPage 1 of 71, 2, 3, 4, 5 ... 7
95 postsPage 1 of 71, 2, 3, 4, 5 ... 7