Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: Parallax laser range finder need help on: August 13, 2012, 03:05:43 pm
im using the parallax LRF but be careful it does not seem to play nice with the arduino (at least from what i found)
2  Using Arduino / Programming Questions / Re: need help with Max7456 on: August 13, 2012, 12:59:13 pm
itthe code is you take a text document and it will display it to the screen you will need to look at the original post for more info http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1220054359

as for the parallax sensor it is a problem in itself the code for it can be found here

http://hackaweek.com/hacks/?page_id=479

i want to remove the LCD and replace it with the OSD and what I want to use is the sensors continuous measurement function on the OSD
3  Using Arduino / Programming Questions / Re: need help with Max7456 on: August 13, 2012, 12:39:03 pm
Code:
#include <EEPROM.h> //Needed to access eeprom read/write functions

#define DATAOUT 11//MOSI
#define DATAIN  12//MISO
#define SPICLOCK  13//sck
#define MAX7456SELECT 10//ss
#define VSYNC 2// INT0

//MAX7456 opcodes
#define DMM_reg   0x04
#define DMAH_reg  0x05
#define DMAL_reg  0x06
#define DMDI_reg  0x07
#define VM0_reg   0x00
#define VM1_reg   0x01

//MAX7456 commands
#define CLEAR_display 0x04
#define CLEAR_display_vert 0x06
#define END_string 0xff
// with NTSC
#define ENABLE_display 0x08
#define ENABLE_display_vert 0x0c
#define MAX7456_reset 0x02
#define DISABLE_display 0x00

// with PAL
// all VM0_reg commands need bit 6 set
//#define ENABLE_display 0x48
//#define ENABLE_display_vert 0x4c
//#define MAX7456_reset 0x42
//#define DISABLE_display 0x40

#define WHITE_level_80 0x03
#define WHITE_level_90 0x02
#define WHITE_level_100 0x01
#define WHITE_level_120 0x00

// with NTSC
#define MAX_screen_size 390
#define MAX_screen_rows 13

// with PAL
//#define MAX_screen_size 480
//#define MAX_screen_rows 16

#define EEPROM_address_hi 510
#define EEPROM_address_low 511
#define EEPROM_sig_hi 'e'
#define EEPROM_sig_low 's'

volatile byte screen_buffer[MAX_screen_size];

volatile byte writeOK;
volatile byte valid_string;
volatile byte save_screen;
volatile int  incomingByte;
volatile int  count;

//
//##############################
//# 30 characters per line     #
//# 13 lines per screen        #
//# start'[' end ']' 390 chars #
//# add '~' if front of '[' to #
//# force write to eeprom      #
//# '~[]' to zero out eeprom   #
//##############################
//
//[
//
//
//       THIS IS A TEST
//
//    Arduino / MAX7456-OSD
//
//  ABCDEFGHIJKLMNOPQRSTUVWXYZ
//         0123456789
//]
//

//////////////////////////////////////////////////////////////
void setup()
{
  byte spi_junk, eeprom_junk;
  int x;
  Serial.begin(9600);
  Serial.flush();

  pinMode(MAX7456SELECT,OUTPUT);
  digitalWrite(MAX7456SELECT,HIGH); //disable device

  pinMode(DATAOUT, OUTPUT);
  pinMode(DATAIN, INPUT);
  pinMode(SPICLOCK,OUTPUT);
  pinMode(VSYNC, INPUT);

  // SPCR = 01010000
  //interrupt disabled,spi enabled,msb 1st,master,clk low when idle,
  //sample on leading edge of clk,system clock/4 rate (4 meg)
  SPCR = (1<<SPE)|(1<<MSTR);
  spi_junk=SPSR;
  spi_junk=SPDR;
  delay(250);

  // force soft reset on Max7456
  digitalWrite(MAX7456SELECT,LOW);
  spi_transfer(VM0_reg);
  spi_transfer(MAX7456_reset);
  digitalWrite(MAX7456SELECT,HIGH);
  delay(500);

  // set all rows to same charactor white level, 90%
  digitalWrite(MAX7456SELECT,LOW);
  for (x = 0; x < MAX_screen_rows; x++)
  {
    spi_transfer(x + 0x10);
    spi_transfer(WHITE_level_90);
  }

  // make sure the Max7456 is enabled
  spi_transfer(VM0_reg);
  spi_transfer(ENABLE_display);
  digitalWrite(MAX7456SELECT,HIGH);


  // clear the array
  for (x = 0; x < MAX_screen_size; x++)
  {
    screen_buffer[x] = 0x00;
  }

  writeOK = false;
  valid_string = false;
  save_screen = false;
  incomingByte = 0;
  count = 0;

 // check to see if we have a default screen stored in eeprom
  eeprom_junk = EEPROM.read(EEPROM_address_hi);
  if (eeprom_junk == EEPROM_sig_hi)
  {
    eeprom_junk = EEPROM.read(EEPROM_address_low);
    if (eeprom_junk == EEPROM_sig_low)
    {
      for (x = 0; x < MAX_screen_size; x++)
      {
        screen_buffer[x] = EEPROM.read(x);
      }
      writeOK = true;
      count = MAX_screen_size;
    }
  }

  Serial.println("Ready for text file download");
  Serial.println("");
  delay(100); 
}
4  Using Arduino / Programming Questions / Re: Parallax laser range finder need help on: August 13, 2012, 12:26:51 pm
Ok well sorry for being for being new at something. I'm no professional, I know more on how to make the 328 than I know how to program it. smiley-sad-blue
5  Using Arduino / Programming Questions / Re: Parallax laser range finder need help on: August 13, 2012, 11:58:51 am
ok here is the link

http://hackaweek.com/hacks/?page_id=479

What i want is to get rid of the LCD code and move it to serial monitor then move onto adding it to the MAX7456 OSD using its continuous measurement function and like in my other post all i have for the OSD is the dfraser code period(no mods to the dfraser code).  So I'm hoping its enough.
6  Using Arduino / Programming Questions / Re: Parallax laser range finder need help on: August 13, 2012, 11:45:52 am
Well this is a code in transition I guess I forgot to put it back the way I had it and just copied in my hacked code. And please, I ask you for help without a condescending attitude. I'm new to this and I want to be pointed in the right direction.

Source of code is the hack-a-week laser range finder code
7  Using Arduino / Programming Questions / Parallax laser range finder need help on: August 13, 2012, 10:58:06 am
so i have a parallax laser range finder but the code i want is not for it to be hooked up to a LCD but to the serial monitor and no matter how much i change it, it wont work

Code:
// include the SoftwareSerial library so we can use it to talk to the LRF
#include <SoftwareSerial.h>

#define rxPin 2  // connect to the LRF's SOUT pin
#define txPin 4  // connect to the LRF's SIN pin thru a 4.7k resister

// set up a new serial port
SoftwareSerial lrfSerial =  SoftwareSerial(rxPin, txPin);

int incomingByte;

void setup() 
{
 Serial.begin(9600);
  incomingByte = lrfSerial.read();
  // define pin modes for tx, rx, led pins:
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  // set the data rate for the SoftwareSerial port
  lrfSerial.begin(9600);

  // send a U to the LRF so that it will autodetect the speed to communicate with us at (9600)
  lrfSerial.print('U');
  // the LRF will send back a : and a newline, we just read and ignore those here
  lrfSerial.read();
  lrfSerial.read();
  Serial.print(incomingByte);

  delay(3000);
  // send a E to the LRF to adjust camera to current lighting conditions
//  lrfSerial.print('E');
//  delay(1000);
  delay(1500);
}

void loop()
{
  // send an R to the LRF telling it to take a measurement
  lrfSerial.print('R');

  // read what the LRF sends back
  char lrfData[32];
  int offset = 0;
  lrfData[0] = 0;
  while(1)
  {
    lrfData[offset]=lrfSerial.read();
    if (lrfData[offset]==':')
    {
      lrfData[offset]=0;
     
      break;
    }
    offset++;
  }
  // print out the data from the LRF (it sends back a string in the form "D = xxxx mm" where xxxx is the distance in milimeters
  Serial.print(lrfData);

  // delay a tiny bit before the next read
  delay(100);

}
8  Using Arduino / Programming Questions / Re: need help with Max7456 on: August 13, 2012, 10:45:47 am
its not that its not working in that im clueless on where to start in constructing the desired code so there is no code cause i dont know where to start
9  Using Arduino / Programming Questions / Re: need help with Max7456 on: August 10, 2012, 05:50:47 pm
just to clarify:

Im doing this cause Im getting paid (development is my job and Im new to arduino)

My test code is the dfraser code for the max7456

and sadly for me at least the max7456.h doesnt seem to want to work, it tells me a bunch of items were not declared in this scope

10  Using Arduino / Programming Questions / need help with Max7456 on: August 07, 2012, 06:50:35 pm
I have a Max7456 I have working test code but I need help with getting numerals to update with an input in real time, specifically the parallax laser rangefinder, and I want to put the input it gives back on screen. I also suck at programming and I need help
Pages: [1]