Pages: [1]   Go Down
Author Topic: need help with Max7456  (Read 897 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48556
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I have a Max7456
We need a link.

Quote
I have working test code but I
didn't post it.

Quote
I also suck at programming
Then, why are you doing this?

Quote
I need help
Well, OK. Sorry to hear that.

Did you have something specific in mind?
Logged

0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

End of the semester, is it?

Here's an example:  http://www.eng.uah.edu/~jdw/avr/MAX7456_example.pde

-j
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Norfolk UK
Offline Offline
Edison Member
*
Karma: 66
Posts: 2482
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Do you have links to this max7456.h header/library and your sample dfraser code so we have a chance to figure out why it fails to work.
Logged

There is no such thing as a stupid question but there are a lot of inquisitive idiots.

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You still haven't presented a link to the MAX7656 nor did you post the dfraser code you referred to.

You don't want us to help you, do you?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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); 
}
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Better than nothing, although not the complete code.

Does that put something on the screen for you?

How have you wired the parallax sensor to your Arduino? Have you run a test with that sensor to see if it's working? What do you wanna achieve? We may help you with specific problems but we won't do your work.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey guys, I am new to the whole forum thing, so bear with me please.
I have just started trying to use the arduino, and I have to do a project involving a arduinoMega and a max7456 (https://www.sparkfun.com/products/9168) breakout board to create an osd. my first issue is even connecting the two boards together, I understand the real basic SPI theory, but don't know why everyone on this thread (http://arduino.cc/forum/index.php/topic,8785.180.html) seems to be using Vsync. (I would comment on this thread, but don't know how)

Sorry for these real basics guys, any help you could give me would be amazing smiley

Cheers
Logged

Pages: [1]   Go Up
Jump to: