# Sunday, April 03, 2005

Anyone taken the time to test out this sample code in the CF and see how it compares to the full framework?  I was surprised at the desktop results, and if it's true for the CF then I'd like to be aware of it.  Does the JITter use registers for locals when available?  If so, how many registers (the FFW has 64 of them)?  Is it processor dependent?

Sunday, April 03, 2005 9:47:03 PM (Central Daylight Time, UTC-05:00)  #     | 
# Tuesday, March 29, 2005

You're probably aware that using dumpbin.exe is very useful if you need to P/InvokedumpbinGUI.exe is a tool that I've been using for years that you might be interested in.  It adds a simply context menu to the Windows shell, so you can right click any DLL or LIB and view it's exports (among other things).

The install leaves a bit to be desired.  You have to have a dev tool installed, and you must modify your path to allow dumpbinGUI to find a couple files.  If you have Studio 2003 installed in the default location, add these to your system path:

C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin
C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE

Tuesday, March 29, 2005 5:47:42 AM (Central Standard Time, UTC-06:00)  #     | 
# Friday, March 25, 2005

For those of you who may ever need to interface to a DS1307 I2C real time clock (it would wourk for the 1306 SPI RTC as well) here's a useful class.

private class RTCTime
{
 private byte[] m_bytes = new byte[7];
 
 public RTCTime()
 {
 }
 public RTCTime(byte[] data)
 {
  m_bytes = data;
 }
 public RTCTime(DateTime dateTime)
 {
  this.Second = dateTime.Second;
  this.Minute = dateTime.Minute;
  this.Hour = dateTime.Hour;
  this.Day = dateTime.Day;
  this.Month = dateTime.Month;
  this.Year = dateTime.Year;
 }
 public static implicit operator byte[](RTCTime rtc)
 {
  return rtc.m_bytes;
 }
 public static implicit operator RTCTime(byte[] bytes)
 {
  return new RTCTime(bytes);
 }
 public static explicit operator DateTime(RTCTime rtc)
 {
  return new DateTime(rtc.Year, rtc.Month, rtc.Day, rtc.Hour, rtc.Minute, rtc.Second, 0);
 }
 public int Second
 {
  get { return BCD_TO_WORD(m_bytes[0]); }
  set { m_bytes[0] = WORD_TO_BCD(value); }
 }
 public int Minute
 {
  get { return BCD_TO_WORD(m_bytes[1]); }
  set { m_bytes[1] = WORD_TO_BCD(value); }
 }
 public int Hour
 {
  get { return BCD_TO_WORD(m_bytes[2]); }
  set { m_bytes[2] = WORD_TO_BCD(value); }
 }
 public int DayOfWeek
 {
  get { return BCD_TO_WORD(m_bytes[3]); }
  set { m_bytes[3] = WORD_TO_BCD(value); }
 }
 public int Day
 {
  get { return BCD_TO_WORD(m_bytes[4]); }
  set { m_bytes[4] = WORD_TO_BCD(value); }
 }
 public int Month
 {
  get { return BCD_TO_WORD(m_bytes[5]); }
  set { m_bytes[5] = WORD_TO_BCD(value); }
 }
 public int Year
 {
  get { return BCD_TO_WORD(m_bytes[6]); }
  set { m_bytes[6] = WORD_TO_BCD(value); }
 }
 public int Length
 {
  get { return m_bytes.Length; }
 }
 private int BCD_TO_WORD(byte x)
 {
  return (x & 0x0f) + ((x >> 4) * 10);
 }
 private byte WORD_TO_BCD(int x)
 {
  return (byte)((x % 10) + ((x / 10) * 0x10));
 }
}
Friday, March 25, 2005 10:36:30 AM (Central Standard Time, UTC-06:00)  #     | 
# Saturday, March 12, 2005

Pocket PC magazine has published an article by Mick Badran of Breeze Training that uses the SDF (though they called it the Smart Device Extensions - remember back when the CF was called that?).  An online version is available here.

Saturday, March 12, 2005 3:53:55 PM (Central Standard Time, UTC-06:00)  #     | 
# Thursday, March 10, 2005

A transmission rate of 10 Mbps implies that each bit is sent in 0.1 microseconds. For a coaxial cable, the speed at which the signal travels along the cable is approximately 0.77 times the speed of light (3.0E8 m/s). A bit therefore occupies 23 meters of cable. That means the smallest frame would be 13.3 km long.

For those who no longer use 10-baseT and gave up coax for twisted pair years ago, propagation speed in twisted pair is much slower - roughly 0.59 times the speed of light.  I'll let you do the math for a frame.

Thursday, March 10, 2005 9:48:07 PM (Central Standard Time, UTC-06:00)  #     |