Greetings,
I have two fez panda 2 boads and i want to set up a CAN network between them. I have been using sample code from the Beginners Guide to NETMF as a baseline for my code.
I am using the GHI NETMD 4.1 SDK and MS C# 2010 express.
I am having compilation errors - please advise, see my complete code below
using System.IO;
using System.Threading;
using System.Text;
using System.IO.Ports;
using System.Resources;
namespace MFConsoleApplication1
{
public class Program
{
public static void Main()
{
///////////////////////////////////////////////////////////
// Bitrate 250Kbps
// CLK = 72 Mhz, with BRP = 12 -> 6Mhz CAN clock
// 6Mhz/250Kbps = 24 TQ
// T1 = 16 minus 1 for sync = 15
// T2 = 8
// 15 + 1 + 8 = 24 TQs which is what we need
//////////////////////////////////////////////////////////
const int BRP = 12;
const int T1 = 15;
const int T2 = 8;
// Initialize CAN channel, set bit rate
CAN canChannel = new CAN(CAN.Channel.Channel_1, ((T2 - 1) << 20) | ((T1 - 1) << 16) | ((BRP - 1) << 0));
// make new CAN message
CAN.Message message = new CAN.Message();
// make a message of 8 bytes
for (int i = 0; i < 8; i++)
message.Data[i] = (byte)i;
message.DLC = 8; // 8 bytes
message.ArbID = 0xAB; // ID
message.IsEID = false; // not extended ID
message.IsRTR = false;// not remote
// send the message
canChannel.PostMessages(message);
// wait for a message and get it.
while (canChannel.GetRxQueueCount() == 0);
// get the message using the same message object
canChannel.GetMessages(message);
// Now "message" contains the data, ID,
// flags of the received message.
}
}
}
The compilation errors are:
Error 1 No overload for method ‘PostMessages’ takes 1 arguments
Error 2 ‘GHIElectronics.NETMF.Hardware.CAN’ does not contain a definition for ‘GetRxQueueCount’ and no extension method ‘GetRxQueueCount’ accepting a first argument of type ‘GHIElectronics.NETMF.Hardware.CAN’ could be found (are you missing a using directive or an assembly reference?)
Error 3 No overload for method ‘GetMessages’ takes 1 arguments
your help will be greatly appreciated.
regards