Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

rex64's Content

There have been 17 items by rex64 (Search limited from 29-March 23)


By content type

See this member's

Sort by                Order  

#25288 DHT11/22 sensor managed driver

Posted by rex64 on 09 March 2012 - 05:14 PM in Project Showcase

Do you know of a good tutorial on how to build custom firmwares? I download the files but was confused on what to do. Also, has anyone built a compiled file they can post? I have a web server if it is to big to post here. Thanks! This is what I am working on: http://forums.netdui...h__1#entry22320



#25287 MPL115A1 Barometric Pressure Sensor Breakout

Posted by rex64 on 09 March 2012 - 05:11 PM in General Discussion

Nothing yet. I put this on hold hoping someone would have more .NET code soon. Also, I have been learning more about C#. If anyone has some good code examples that would be great!



#22883 Reset not working, preparing to deploy assemblies to the device netduino

Posted by rex64 on 17 January 2012 - 07:33 PM in General Discussion

Any other ideas?



#22816 MPL115A1 Barometric Pressure Sensor Breakout

Posted by rex64 on 16 January 2012 - 02:27 AM in General Discussion

I am not sure how to convert the #defines to constants? Are these shorts? Any other tips you can give me would be great. I am used to VB .NET and am very rusty on my C++.

Error 1 Single-line comment or end-of-line expected C:\Users\Jeff\AppData\Local\Temporary Projects\MPL115A1 Pressure Sensor\Program.cs 4 21 MPL115A1 Pressure Sensor



 // the sensor communicates using SPI, so include the library:
//#include <SPI.h>

	#define PRESH   0x80
	#define   PRESL   0x82
	#define   TEMPH   0x84
	#define   TEMPL   0x86

	#define A0MSB   0x88
	#define A0LSB   0x8A
	#define B1MSB   0x8C
	#define B1LSB   0x8E
	#define   B2MSB   0x90
	#define B2LSB   0x92
	#define C12MSB   0x94
	#define   C12LSB   0x96

	#define CONVERT   0x24   

	#define chipSelectPin 10
	#define shutDown 7

	float A0_;
	float B1_;
	float B2_;
	float C12_;


using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;

	/*
	MPL115A1 sparkfun breakout baropressure meter
	SDN   	: pin 7
	CSN   	: pin 10
	SDI/MOSI  : pin 11
	SDO/MISO  : pin 12
	SCK   	: pin 13
	*/



namespace MPL115A1_Pressure_Sensor
{
	public class Program
	{
    	public static void Main()
    	{
        	// write your code here


    	}

	}
}


	void setup() {
  	Serial.begin(115200);

  	// start the SPI library:
  	SPI.begin();   

  	// initalize the data ready and chip select pins:
  	pinMode(shutDown, OUTPUT);
  	digitalWrite(shutDown, HIGH);
  	pinMode(chipSelectPin, OUTPUT);
  	digitalWrite(chipSelectPin, HIGH);
  	delay (10);
	 
  	// read registers that contain the chip-unique parameters to do the math
  	unsigned int A0H = readRegister(A0MSB);
  	unsigned int A0L = readRegister(A0LSB);
         	A0_ = (A0H << 5) + (A0L >> 3) + (A0L & 0x07) / 8.0;
	 
  	unsigned int B1H = readRegister(B1MSB);
  	unsigned int B1L = readRegister(B1LSB);
          	B1_ = ( ( ( (B1H & 0x1F) * 0x100)+B1L) / 8192.0) - 3 ;
	 
  	unsigned int B2H = readRegister(B2MSB);
  	unsigned int B2L = readRegister(B2LSB);
          	B2_ = ( ( ( (B2H - 0x80) << 8) + B2L) / 16384.0 ) - 2 ;
	 
  	unsigned int C12H = readRegister(C12MSB);
  	unsigned int C12L = readRegister(C12LSB);
          	C12_ = ( ( ( C12H * 0x100 ) + C12L) / 16777216.0 )  ;
	}

	void loop() {
   	Serial.print("de druk is : ");
   	Serial.println(baropPessure());
   	delay(1000);
	} 

	//Read registers
	unsigned int readRegister(byte thisRegister ) {
  	unsigned int result = 0;   // result to return
  	digitalWrite(chipSelectPin, LOW);
    	delay(10);
    	SPI.transfer(thisRegister);
    	result = SPI.transfer(0x00);
  	digitalWrite(chipSelectPin, HIGH);
  	return(result);
	}

	//read pressure
	float baropPessure(){
  	digitalWrite(chipSelectPin, LOW);
  	delay(3);
    	SPI.transfer(0x24);
    	SPI.transfer(0x00);
    	digitalWrite(chipSelectPin, HIGH);
    	delay(3);
  	digitalWrite(chipSelectPin, LOW);
    	SPI.transfer(PRESH);
    	unsigned int presH = SPI.transfer(0x00);
        	delay(3);
    	SPI.transfer(PRESL);
    	unsigned int presL = SPI.transfer(0x00);
        	delay(3);
    	SPI.transfer(TEMPH);
    	unsigned int tempH = SPI.transfer(0x00);
        	delay(3);
    	SPI.transfer(TEMPL);
    	unsigned int tempL = SPI.transfer(0x00);
        	delay(3);
    	SPI.transfer(0x00);
      	delay(3);
  	digitalWrite(chipSelectPin, HIGH);

  	unsigned long press = ((presH *256) + presL)/64;
  	unsigned long temp  = ((tempH *256) + tempL)/64;

  	float pressure = A0_+(B1_+C12_*temp)*press+B2_*temp;
  	float preskPa = pressure*  (65.0/1023.0)+50.0;

	return(preskPa);
	}



#22815 Convert to C# Humidity and Temperature Sensor - RHT03 RHT-22

Posted by rex64 on 16 January 2012 - 02:01 AM in General Discussion

What language is the firmware written in? Do I use this compiler: Visual C++ 2010 Express? Also, are these the files I would be editing? \netduinofirmware\netduinofirmware_4.1.0.6\Solutions\NetduinoPlus Also, I do not understand what this step means. Am I changing the Micro Framework or the Duino firmware? Are they the same? 2. Copy these files over the Platform Kit (typically into C:\MicroFrameworkPK_v4_1) If you get a chance, it would be great to have your built firmware, since I am new at these things. Thanks!



#22469 Convert to C# Humidity and Temperature Sensor - RHT03 RHT-22

Posted by rex64 on 05 January 2012 - 01:54 PM in General Discussion

Ok I will try that. Can you post a compiled firmware to make it easier? Do I just make the modifications that you mentioned in the first post? Also, maybe my sensor is fried, can you give me a few tips so I can play with my 2nd sensor? http://forums.netdui...h__1#entry22357



#22450 Convert to C# Humidity and Temperature Sensor - RHT03 RHT-22

Posted by rex64 on 04 January 2012 - 11:02 PM in General Discussion

Ok, I changed to Dht22 and I made sure internal was selected. Anything else? I am still getting the same errors.

var dhtSensor = new Dht22Sensor(Pins.GPIO_PIN_D0, Pins.GPIO_PIN_D1, PullUpResistor.Internal);

Debug Window:

DHT sensor data timeout.
DHT sensor Read() failed
DHT sensor Read() ok, RH = 0.0%, Temp = 0.0°C
DHT sensor data has invalid checksum.
DHT sensor Read() failed
DHT sensor data has invalid checksum.
DHT sensor Read() failed




#22434 Convert to C# Humidity and Temperature Sensor - RHT03 RHT-22

Posted by rex64 on 04 January 2012 - 01:41 PM in General Discussion

Debug.Assert(data[1] == 0, "Humidity decimal part should be zero."); The data inside data is: 5 222 66 201 Debug window: DHT sensor Read() failed DHT sensor data has invalid checksum. DHT sensor Read() failed DHT sensor Read() ok, RH = 0.0%, Temp = 0.0°C DHT sensor data has invalid checksum.



#22424 Convert to C# Humidity and Temperature Sensor - RHT03 RHT-22

Posted by rex64 on 04 January 2012 - 03:16 AM in General Discussion

I get this error (I had the 5v reversed earlier :)) An unhandled exception of type 'System.InvalidOperationException' occurred in DhtSensorApp.exe Additional information: DHT sensor pins are not connected together.



#22399 Convert to C# Humidity and Temperature Sensor - RHT03 RHT-22

Posted by rex64 on 03 January 2012 - 03:53 PM in General Discussion

See attached. The left to right goes from bottom to top starting at the 4th row. :)

Attached Thumbnails

  • tempAndHumidity.jpg



#22377 Convert to C# Humidity and Temperature Sensor - RHT03 RHT-22

Posted by rex64 on 03 January 2012 - 04:22 AM in General Discussion

The USB power light (white) goes dim after about 1 second of plugging in. I think Something must be wrong. I do not know where to hook up the resistor yet, so I just used the built in. Am I supposed to use digital? And is it ok to use the gnd and 5v on the Duino to power?



#22360 Convert to C# Humidity and Temperature Sensor - RHT03 RHT-22

Posted by rex64 on 02 January 2012 - 06:09 PM in General Discussion

I am almost ready to start testing :) Is there a good free electronics simulator? I want to make sure I hook this up correctly. Do I need any resistors, diodes or anything else in-between? Does this look correct. Left is what I am hooking it up to, right is the sensor. Left to right pin order when looking at device front: 5V Duino -- VDD Power Supply Digital 0 -- Data Signal Nothing -- Null Duino Gnd -- Ground



#22357 MPL115A1 Barometric Pressure Sensor Breakout

Posted by rex64 on 02 January 2012 - 06:00 PM in General Discussion

I am attempting to get MPL115A1 Barometric Pressure Sensor Breakout to work in C# 2010.

Does anyone have a good example to get me started? I searched this form but did not find anything on this sensor.

Here is the product link:
http://www.sparkfun.com/products/9721


Here is the code if it helps:
/*
	MPL115A1 SPI Digital Barometer Test Code
	Created on: April 20, 2010
	By: Jim Lindblom - jim at sparkfun.com
	
	This is a simple test program for the MPL115A1 Pressure Sensor (SPI version).
	UBRR0 is set to 51 and U2X0 is not set, so the baud rate will be 9600@8MHz and 19200@16MHz.
	Press the spacebar to get the pressure measurement.
	
	Hardware: ATmega328 (I used the Arduino Pro platform)
	Powered at 3.3V, running at 8MHz.
	The sensor is 5V tolerant, and this code should also work on 5V/16MHz Arduinos.
	
	MPL115A1 Breakout -------------	Arduino
	-----------------				-------
			SDN	------------------- D9 (PB1)
			CSN	------------------- D8 (PB0)
			SDO	------------------- D12 (PB4)
			SDI	------------------- D11 (PB3)
			SCK	------------------- D13 (PB5)
			GND	--------------------- GND
			VDD	------------------- VCC (3.3V)
			
	License: CCAv3.0 Attribution-ShareAlike (http://creativecommons.org/licenses/by-sa/3.0/)
	You're free to use this code for any venture, but I'd love to hear about what you do with it,
	and any awesome changes you make to it.	Attribution is greatly appreciated.
*/

//======================//
//		Includes		//
//======================//
#include <avr/io.h>
#include <stdio.h>
#include "MPL115A1.h"

//======================//
// 		 Macros			//
//======================//
#define sbi(var, mask)   ((var) |= (uint8_t)(1 << mask))
#define cbi(var, mask)   ((var) &= (uint8_t)~(1 << mask))

//======================//
// 	 MPL115A1 Defines	//
//======================//
#define CS 0 //pin for chip select
#define SDN 1	// pin for interrupt

//======================//
//	General Functions	//
//======================//
void ioinit(void);
void delay_ms(uint16_t x);
void delay_us(uint16_t x);
static int uart_putchar(char c, FILE *stream);
uint8_t uart_getchar(void);
static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);

//======================//
//	MPL115A1 Functions	//
//======================//
void init_SPI(void);
void txdata(char data);
char rxdata(void);
char read(uint8_t address);
void write(uint8_t address, char data);
float calculatePressure(void);

//======================//
//	 Global Variables	//
//======================//
signed char sia0MSB, sia0LSB;
signed char sib1MSB, sib1LSB;
signed char sib2MSB, sib2LSB;
signed char sic12MSB, sic12LSB;
signed char sic11MSB, sic11LSB;
signed char sic22MSB, sic22LSB;
signed int sia0, sib1, sib2, sic12, sic11, sic22, siPcomp;
float decPcomp;
signed long lt1, lt2, lt3, si_c11x1, si_a11, si_c12x2;
signed long si_a1, si_c22x2, si_a2, si_a1x1, si_y1, si_a2x2;
unsigned int uiPadc, uiTadc;
unsigned char uiPH, uiPL, uiTH, uiTL;


int main(void)
{
	ioinit();
	
	init_SPI();
	sbi(PORTB,CS);	// CS Idle High
	sbi(PORTB,SDN);	// SDN high turns sensor on
	
	printf("\n***************MPR115A1 Test****************\n\n");
	
	// main program loop
	while(1){
		printf("\nPress space to print pressure\n");
		while( !(UCSR0A & (1<<RXC0)) )
			;
		if (UDR0 == ' ')
			printf("Pressure = %f\n", calculatePressure());
	}
}

float calculatePressure()
{
	write(0x24, 0x00);	// Start Both Conversions
	// write(0x20, 0x00);	// Start Pressure Conversion
	// write(0x22, 0x00);	// Start temperature conversion
	delay_ms(10);	// Typical wait time is 3ms
	
	// Read pressure
	uiPH = read(PRESH);
	uiPL = read(PRESL);
	uiTH = read(TEMPH);
	uiTL = read(TEMPL);
	
	uiPadc = (unsigned int) uiPH << 8;
	uiPadc += (unsigned int) uiPL & 0x00FF;
	uiTadc = (unsigned int) uiTH << 8;
	uiTadc += (unsigned int) uiTL & 0x00FF;
	
	// Placing Coefficients into 16-bit Variables
	// a0
	sia0MSB = read(A0MSB);
	sia0LSB = read(A0LSB);
	sia0 = (signed int) sia0MSB << 8;
	sia0 += (signed int) sia0LSB & 0x00FF;
	
	// b1
	sib1MSB = read(B1MSB);
	sib1LSB = read(B1LSB);
	sib1 = (signed int) sib1MSB << 8;
	sib1 += (signed int) sib1LSB & 0x00FF;
	
	// b2
	sib2MSB = read(B2MSB);
	sib2LSB = read(B2LSB);
	sib2 = (signed int) sib2MSB << 8;
	sib2 += (signed int) sib2LSB & 0x00FF;
	
	// c12
	sic12MSB = read(C12MSB);
	sic12LSB = read(C12LSB);
	sic12 = (signed int) sic12MSB << 8;
	sic12 += (signed int) sic12LSB & 0x00FF;
	
	// c11
	sic11MSB = read(C11MSB);
	sic11LSB = read(C11LSB);
	sic11 = (signed int) sic11MSB << 8;
	sic11 += (signed int) sic11LSB & 0x00FF;
	
	// c22
	sic22MSB = read(C22MSB);
	sic22LSB = read(C22LSB);
	sic22 = (signed int) sic22MSB << 8;
	sic22 += (signed int) sic22LSB & 0x00FF;
	
	// Coefficient 9 equation compensation
	uiPadc = uiPadc >> 6;
	uiTadc = uiTadc >> 6;
	
	// Step 1 c11x1 = c11 * Padc
	lt1 = (signed long) sic11;
	lt2 = (signed long) uiPadc;
	lt3 = lt1*lt2;
	si_c11x1 = (signed long) lt3;
	
	// Step 2 a11 = b1 + c11x1
	lt1 = ((signed long)sib1)<<14;
	lt2 = (signed long) si_c11x1;
	lt3 = lt1 + lt2;
	si_a11 = (signed long)(lt3>>14);
	
	// Step 3 c12x2 = c12 * Tadc
	lt1 = (signed long) sic12;
	lt2 = (signed long) uiTadc;
	lt3 = lt1*lt2;
	si_c12x2 = (signed long)lt3;
	
	// Step 4 a1 = a11 + c12x2
	lt1 = ((signed long)si_a11<<11);
	lt2 = (signed long)si_c12x2;
	lt3 = lt1 + lt2;
	si_a1 = (signed long) lt3>>11;
	
	// Step 5 c22x2 = c22*Tadc
	lt1 = (signed long)sic22;
	lt2 = (signed long)uiTadc;
	lt3 = lt1 * lt2;
	si_c22x2 = (signed long)(lt3);
	
	// Step 6 a2 = b2 + c22x2
	lt1 = ((signed long)sib2<<15);
	lt2 = ((signed long)si_c22x2>1);
	lt3 = lt1+lt2;
	si_a2 = ((signed long)lt3>>16);
	
	// Step 7 a1x1 = a1 * Padc
	lt1 = (signed long)si_a1;
	lt2 = (signed long)uiPadc;
	lt3 = lt1*lt2;
	si_a1x1 = (signed long)(lt3);
	
	// Step 8 y1 = a0 + a1x1
	lt1 = ((signed long)sia0<<10);
	lt2 = (signed long)si_a1x1;
	lt3 = lt1+lt2;
	si_y1 = ((signed long)lt3>>10);
	
	// Step 9 a2x2 = a2 * Tadc
	lt1 = (signed long)si_a2;
	lt2 = (signed long)uiTadc;
	lt3 = lt1*lt2;
	si_a2x2 = (signed long)(lt3);
	
	// Step 10 pComp = y1 + a2x2
	lt1 = ((signed long)si_y1<<10);
	lt2 = (signed long)si_a2x2;
	lt3 = lt1+lt2;
	
	// Fixed point result with rounding
	//siPcomp = ((signed int)lt3>>13);
	siPcomp = lt3/8192;
	
	// decPcomp is defined as a floating point number
	// Conversion to decimal value from 1023 ADC count value
	// ADC counts are 0 to 1023, pressure is 50 to 115kPa respectively
	decPcomp = ((65.0/1023.0)*siPcomp)+50;
	
	return decPcomp;
}

void write(uint8_t address, char data)
{
	//write any data byte to any single address
	//adds a 0 to the MSB of the address byte (WRITE mode)

	address &= 0x7F;	

	//printf("\nWriting 0x%x to 0x%x\n", data, address);

	cbi(PORTB,CS);
	delay_ms(1);
	txdata(address);
	delay_ms(1);
	txdata(data);
	delay_ms(1);
	sbi(PORTB,CS);
}

char read(uint8_t address)
{
	//returns the contents of any 1 byte register from any address
	//sets the MSB for every address byte (READ mode)

	char byte;

	address |= 0x80;

	cbi(PORTB,CS);
	txdata(address);
	byte = rxdata();
	sbi(PORTB,CS);

	return byte;
}

char rxdata(void)
{
	SPDR = 0x55;
	
	while((SPSR&0x80) == 0x00)
		;

	return SPDR;
}

void txdata(char data)
{
	SPDR = data;
	while((SPSR&0x80) == 0x00)
		;
}

void init_SPI(void)
{
	sbi(SPCR,MSTR); //make SPI master
	cbi(SPCR,CPOL); cbi(SPCR,CPHA); //SCL idle low, sample data on rising edge
	cbi(SPCR,SPR1); cbi(SPCR,SPR0); sbi(SPSR,SPI2X); //Fosc/4 is SPI frequency
	sbi(SPCR,SPE); //enable SPI
}

static int uart_putchar(char c, FILE *stream)
{
	if (c == '\n') uart_putchar('\r', stream);

	loop_until_bit_is_set(UCSR0A, UDRE0);
	UDR0 = c;

	return 0;
}

uint8_t uart_getchar(void)
{
	while( !(UCSR0A & (1<<RXC0)) )
		;
	return(UDR0);
}


void ioinit (void)
{
	int MYUBRR = 51;	// Results in 9600bps@8MHz or 19200bps@16MHz
	
	//1 = output, 0 = input
	//DDRA = 0b00000000; //ADC inputs
	DDRB = 0b11101111; //MISO input
	DDRC = 0b11111111; //All outputs
	DDRD = 0b11111110; //PORTD (RX on PD0)
	stdout = &mystdout; //Required for printf init

	UBRR0H = (MYUBRR) >> 8;
	UBRR0L = MYUBRR;
	UCSR0B = (1<<RXEN0)|(1<<TXEN0);
	UCSR0C = (3<<UCSZ00);

	TCCR2B = (1<<CS21);
}

//General short delays
void delay_ms(uint16_t x)
{
	for (; x > 0 ; x--)
    	delay_us(1000);
}

//General short delays
void delay_us(uint16_t x)
{
	while(x > 256)
	{
    	TIFR2 = (1<<TOV2); //Clear any interrupt flags on Timer2
    	TCNT2 = 0; //256 - 125 = 131 : Preload timer 2 for x clicks. Should be 1us per click
    	while( (TIFR2 & (1<<TOV2)) == 0);

    	x -= 256;
	}

	TIFR2 = (1<<TOV2); //Clear any interrupt flags on Timer2
	TCNT2= 256 - x; //256 - 125 = 131 : Preload timer 2 for x clicks. Should be 1us per click
	while( (TIFR2 & (1<<TOV2)) == 0);
}





#22320 Convert to C# Humidity and Temperature Sensor - RHT03 RHT-22

Posted by rex64 on 01 January 2012 - 09:19 PM in General Discussion

I am trying to convert this sample code to C# for the Humidity and Temperature Sensor - RHT03 RHT-22. Sorry I am new to NetDuino and C#, and could not find anything writting in C# for this sensor online. Please try and make it easy for me to see the reasults in the debugger :)

http://www.sparkfun.com/products/10167

This is my bad attempt. I started commenting things out but there were lots of custom data types and I do not know the best way to get this this done. If someone can help me convert this it would be helpful.
  //****************************************************************//
//	              Program for AM230x series 
//MCU  AT89S52 ,   Frequency of crystal oscillator: 11.0592MHz
//Function Transmit RH & Temp. Data via PC interface ,  Baud rate 9600 
//Connection P2.0 connected with DHT sensor   
// Company   Aosong Electronics   
//****************************************************************//

//#define uchar unsigned char
//#define uint unsigned int
//#define   Data_0_time    4

using System;
using Microsoft.SPOT;

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace NetduinoApplication1
{







//using reg51.h;

//#include <reg51.h>
//#include <intrins.h> 
//
typedef unsigned char  U8;       /* defined for unsigned 8-bits integer variable 	     */
typedef signed   char  S8;       /* defined for signed 8-bits integer variable		   */
typedef unsigned int   U16;      /* defined for unsigned 16-bits integer variable 	     */
typedef signed   int   S16;      /* defined for signed 16-bits integer variable 	     */
typedef unsigned long  U32;      /* defined for unsigned 32-bits integer variable 	  */
typedef signed   long  S32;      /* defined for signed 32-bits integer variable 	      */
typedef float          F32;      /* single precision floating point variable (32bits)    */
typedef double         F64;      /* double precision floating point variable (64bits)    */
//


//----------------------------------------------//
//----------------Definition for IO interface--------------------//
//----------------------------------------------//
sbit  P2_0  = P2^0 ;
sbit  P2_1  = P2^1 ;
sbit  P2_2  = P2^2 ;
sbit  P2_3  = P2^3 ;
//----------------------------------------------//
//----------------Definition zone--------------------//
//----------------------------------------------//
U8  U8FLAG,k;
U8  U8count,U8temp;
U8  U8T_data_H,U8T_data_L,U8RH_data_H,U8RH_data_L,U8checkdata;
U8  U8T_data_H_temp,U8T_data_L_temp,U8RH_data_H_temp,U8RH_data_L_temp,U8checkdata_temp;
U8  U8comdata;
U8  outdata(5);  
U8  indata(5);
U8  count, count_r=0;
U8  str(5)={"RS232"};
U16 U16temp1,U16temp2;
SendData(U8 *a)
{
    outdata(0) = a(0); 
    outdata(1) = a(1);
    outdata(2) = a(2);
    outdata(3) = a(3);
    outdata(4) = a(4);
    count = 1;
    SBUF=outdata(0);
}

       void Delay(U16 j)
    {      U8 i;
        for(;j>0;j--)
      { 	
        for(i=0;i<27;i++);

      }
    }
       void  Delay_10us(void)
      {
        U8 i;
        i--;
        i--;
        i--;
        i--;
        i--;
        i--;
       }

        void  COM(void)
      {

            U8 i;
       for(i=0;i<8;i++)	   
        {

            U8FLAG=2;

        while((!P2_0)&&U8FLAG++);
            Delay_10us();
            Delay_10us();
            Delay_10us();
            U8temp=0;
         if(P2_0)U8temp=1;
            U8FLAG=2;
         while((P2_0)&&U8FLAG++);


         if(U8FLAG==1)break;


           U8comdata<<=1;
           U8comdata|=U8temp;        //0
         }//rof

    }

    //--------------------------------
    //-----Sub-program for reading %RH ------------
    //--------------------------------
    //----All the variable bellow is global variable--------
    //----Temperature's high 8bit== U8T_data_H------
    //----Temperature's low 8bit== U8T_data_L------
    //----Humidity's high 8bit== U8RH_data_H-----
    //----Humidity's low 8bit== U8RH_data_L-----
    //----Check-sum 8bit == U8checkdata-----
    //--------------------------------

    void RH(void)
    {

     P2_0=0;
       Delay(5);
       P2_0=1;
       Delay_10us();
       Delay_10us();
       Delay_10us();
       Delay_10us();
       P2_0=1;	  
       if(!P2_0)		  
       {
       U8FLAG=2;
       while((!P2_0)&&U8FLAG++);
       U8FLAG=2;
       while((P2_0)&&U8FLAG++);
       COM();
       U8RH_data_H_temp=U8comdata;
       COM();
       U8RH_data_L_temp=U8comdata;
       COM();
       U8T_data_H_temp=U8comdata;
       COM();
       U8T_data_L_temp=U8comdata;
       COM();
       U8checkdata_temp=U8comdata;
       P2_0=1;

       U8temp=(U8T_data_H_temp+U8T_data_L_temp+U8RH_data_H_temp+U8RH_data_L_temp);
       if(U8temp==U8checkdata_temp)
       {
          U8RH_data_H=U8RH_data_H_temp;
          U8RH_data_L=U8RH_data_L_temp;
          U8T_data_H=U8T_data_H_temp;
          U8T_data_L=U8T_data_L_temp;
          U8checkdata=U8checkdata_temp;
       }//fi
       }//fi

    }

//----------------------------------------------
//               main()
//----------------------------------------------
void main()
{
    U8  i,j;


    TMOD = 0x20;	  
    TH1 = 253;        
    TL1 = 253;
    TR1 = 1;          
    SCON = 0x50;	  
    ES = 1;
    EA = 1;           
    TI = 0;
    RI = 0;
    SendData(str) ;   
    Delay(1);         
    while(1)
    {  

       //------------------------
       //
       RH();
       //--------------------------

       str(0)=U8RH_data_H;
       str(1)=U8RH_data_L;
       str(2)=U8T_data_H;
       str(3)=U8T_data_L;
       str(4)=U8checkdata;
       SendData(str) ;  

       Delay(20000);
    }//elihw

}// main

void RSINTR() interrupt 4 using 2
{
    U8 InPut3;
    if(TI==1) 
    {
        TI=0;
        if(count!=5) 
        {
            SBUF= outdata(count);
            count++;
        }
    }

    if(RI==1)	 
    {	
        InPut3=SBUF;
        indata(count_r)=InPut3;
        count_r++;
        RI=0;								 
        if (count_r==5)
        {

            count_r=0;
        str(0)=indata(0);
         str(1)=indata(1);
           str(2)=indata(2);
             str(3)=indata(3);
                 str(4)=indata(4);
                 P0=0;
        }
    }
}

    }




#22317 Reset not working, preparing to deploy assemblies to the device netduino

Posted by rex64 on 01 January 2012 - 07:33 PM in General Discussion

I told VS to start debugging. It gets stuck on 'preparing to deploy assemblies to the device'. When I press the reset button the program I wrote at work is running. When I unplug the usb and re-attach the 3 network lights, blue light, and white light turn on. Then the network lights go out then the blue light goes out (and white stays on). I can press the button at any time and i get the blinky light I programmed at work. I want this to work at home :) After a while I get this error: Error 1 Unable to communicate with device - USB:NetduinoPlus



#22309 Reset not working, preparing to deploy assemblies to the device netduino

Posted by rex64 on 01 January 2012 - 02:37 PM in General Discussion

I do not know how to check, but I would assume that it is NOT beta (I have not updated it). MS VS 2010 C# gets stuck on "preparing to deploy assemblies to the device"

Hi rex64,

Are you running the regular production 4.1.0.6 firmware or the 4.2 beta firmware?

I think that your post got submitted just before you were able to finish it. What part of the process does your Windows XP machine get stuck on?

Chris




#22297 Reset not working, preparing to deploy assemblies to the device netduino

Posted by rex64 on 01 January 2012 - 01:35 AM in General Discussion

Hey, this is my first robot expericne. I was unable to get this Netduino that I just bought to work at home, but I was able to make my own app and install it from my work computer.I tried to follow these instructions below to reset things, but it does not ask me confirmation on the erase. Also, I do not think the ping is working. The ping and erase both seem to lockup the app. I do see the NetDuino in the combo box after a couple of seconds of plugging it in. I made sure that the Visual Studio was closed before I attempted. I re-booted computer as well. I also tried selecting a differnt option in the project file and then re-seleting the NetDuino (I am not sure the best order to do this, do I hit the save button?)

These are the instructions I tried to follow to erase:

1- Press and hold the push button on the netduino for the whole procedure (leave it pushed at all times)
2- Plug the USB to the computer
3- You should see the combobox in MFDeploy.exe contain your usb port
4- Press as fast as you can the "erase" button on MFDeploy.exe
5- You can now release the push button on the netduino


I am running XP SP3. It gets stuck on




home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.