Show Posts
Pages: [1] 2 3 ... 6
1  Development / Other Hardware Development / Re: Arduino Without FTDI chip using V-USB (Virtual USB) on: November 12, 2012, 05:36:56 am
Rashed,

As decsribed in Metalab site "AVR's UART lines are not used for USB. This means that they can be used for other purposes, but also that debug output written to the UART cannot be directly received via USB."

Unfortunately Metaboard doesn't support Serial communitication via USB.
2  Using Arduino / Programming Questions / Re: Connecting two ardunio boards using an RF link on: November 18, 2011, 05:27:04 am
Module seems to same as RF12B. Try Jeenode RF12 libraries.
3  Using Arduino / Programming Questions / Re: long press button on: November 04, 2011, 05:36:43 am
Jeff has a nice code for button click, double click, hold & long hold. Please look it http://jmsarduino.blogspot.com/2009/10/4-way-button-click-double-click-hold.html
4  Using Arduino / Programming Questions / Re: problem using the map() function.. on: October 18, 2011, 03:40:25 am
Your map range is 0 to 3. But you are expecting values in range 1 to 4.

Quote
waveSelect = map(pot1, 0, 1023, 0, 3);      //waveform pot, divided into 4 
5  Using Arduino / Programming Questions / Re: Manage ports? on: September 19, 2011, 03:08:10 am
@WizenedEE

Yes you are right, direct hardware usage is always faster than prototype functions.  But most of Arduino users including me have not electronic background. For us really hard to understand MCU hardware basics. And the aim of Arduino platform is to make the usage of microcontroller easier to everyone. IMO with these port functions every Arduino user can easily use the ports.
6  Using Arduino / Programming Questions / Re: Manage ports? on: September 19, 2011, 12:27:26 am
Sorry my fault you also have to put function prototypes in "Arduino.h".
Function prototypes are;
Code:
void portMode(uint8_t port, uint8_t mode);
uint8_t portRead(uint8_t port);
void portWrite(uint8_t port, uint8_t val);
7  Using Arduino / Programming Questions / Re: Manage ports? on: September 18, 2011, 02:48:36 pm
As I mentioned I saw these functions in Wiring source. After testing them I put them in wiring_digital.c to make them built-in.

They works well in regular code also.  But you should add "false" after return of statement "if (inputregister == NOT_A_PORT) return;"
in portRead function.
8  Using Arduino / Displays / Re: Can I make more than 8 own characters in 16x2 LCD display on: September 18, 2011, 10:41:53 am
Do you need all 8 characters at a time? Only trick is you can discard unused ones and create new.
9  Using Arduino / Programming Questions / Re: Manage ports? on: September 18, 2011, 02:02:26 am
I have mooched the port manipulation functions from wiring platform. Copy them into "wiring_digital.c" to have built-in port manipulation.

Functions
Code:
void portMode(uint8_t port, uint8_t mode)
{
volatile uint8_t *moderegister;

moderegister = portModeRegister(port);

if (moderegister == NOT_A_PORT) return;

uint8_t oldSREG = SREG;
cli();

//*moderegister = mode;
if (mode == OUTPUT)
*moderegister = 0xff;
else
*moderegister = 0x00;

SREG = oldSREG;
}

uint8_t portRead(uint8_t port)
{
volatile uint8_t *inputregister;

inputregister = portInputRegister(port);

if (inputregister == NOT_A_PORT) return;

uint8_t oldSREG = SREG;
cli();
uint8_t portValue = *inputregister;
SREG = oldSREG;
return portValue;
}

void portWrite(uint8_t port, uint8_t val)
{
volatile uint8_t *portregister;

portregister = portOutputRegister(port);

if (portregister == NOT_A_PORT) return;

uint8_t oldSREG = SREG;
cli();
*portregister = val;
SREG = oldSREG;
}

Example
Code:
void setup() {
  portMode(PD, OUTPUT);
}

void loop() {
  portWrite(PD, B0001000);
  delay(500);
  portWrite(PD, B0000000);
  delay(500);
}
10  Using Arduino / Displays / Re: DIP204-4 with SPI on: September 14, 2011, 12:28:30 am
According to datasheet I could not see "Display on" command on your sketch.
11  Development / Other Hardware Development / Re: ATMEL Mega1284P evaluation board avalible on: September 11, 2011, 07:22:45 am
The link is http://code.google.com/p/brewtroller/downloads/detail?name=Sanguino1284P.zip&can=2&q= which I have downloaded.
12  Development / Other Hardware Development / Re: ATMEL Mega1284P evaluation board avalible on: September 10, 2011, 09:52:04 pm
I made small modifications on version arduino-1.0-beta4 and it works well on my Atmega1284.

Board definition is;
Code:
atmega1284.name=Bobuino W/ ATmega1284P

atmega1284.upload.protocol=arduino
atmega1284.upload.maximum_size=131072
atmega1284.upload.speed=57600

atmega1284.bootloader.low_fuses=0xFF
atmega1284.bootloader.high_fuses=0xDC
atmega1284.bootloader.extended_fuses=0xFD
atmega1284.bootloader.path=sanguino
atmega1284.bootloader.file=ATmegaBOOT_168_atmega1284p.hex
atmega1284.bootloader.unlock_bits=0x3F
atmega1284.bootloader.lock_bits=0x0F

atmega1284.build.mcu=atmega1284p
atmega1284.build.f_cpu=16000000L
atmega1284.build.core=arduino
atmega1284.build.variant=Bobuino


pins_arduino.h file in folder "C:\arduino-1.0-beta4\hardware\arduino\variants\Bobuino"
Code:
/*
  pins_arduino.h - pin definitions for the Arduino board
  Part of Arduino / Wiring Lite

  Copyright (c) 2005 David A. Mellis

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General
  Public License along with this library; if not, write to the
  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  Boston, MA  02111-1307  USA

  $Id: pins_arduino.c 254 2007-04-20 23:17:38Z mellis $
*/

#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include <avr/pgmspace.h>

#define NUM_DIGITAL_PINS            32
#define NUM_ANALOG_INPUTS           8
#define analogInputToDigitalPin(p)  ((p <   8) ? (p) + 24 : -1)
#define analogInputPinToBit(p)      ((P >= 24) ? (p) - 24 : -1)
#define digitalPinHasPWM(p)         ((p) == 3 || (p) == 4 || (p) == 12 || (p) == 13 || (p) == 14 || (p) == 15)

const static uint8_t SS   = 4;
const static uint8_t MOSI = 5;
const static uint8_t MISO = 6;
const static uint8_t SCK  = 7;

const static uint8_t SDA  = 17;
const static uint8_t SCL  = 16;
const static uint8_t LED  = 13;

const static uint8_t A0   = 24;
const static uint8_t A1   = 25;
const static uint8_t A2   = 26;
const static uint8_t A3   = 27;
const static uint8_t A4   = 28;
const static uint8_t A5   = 29;
const static uint8_t A6   = 30;
const static uint8_t A7   = 31;

//  Bit        7        6        5        4       3         2       1        0
// PCMSK3 = PCINT31, PCINT30, PCINT29, PCINT28, PCINT27, PCINT26, PCINT25, PCINT24
// Dg.Pin     15        14       13      12        11       10      9        8 PCICRBit = 1
// PCMSK2 = PCINT23, PCINT22, PCINT21, PCINT20, PCINT19, PCINT18, PCINT17, PCINT16
// Dg.Pin     23        22       21      20        19       18      17       16 PCICRBit = 2
// PCMSK1 = PCINT15, PCINT14, PCINT13, PCINT12, PCINT11, PCINT10, PCINT9,  PCINT8
// Dg.Pin     7         6         5       4        3         2      1         0 PCICRBit = 0
// PCMSK0 = PCINT7,  PCINT6,  PCINT5,  PCINT4,  PCINT3,  PCINT2,  PCINT1,  PCINT0
// Dg.Pin     31       30        29      28       27       26       25       24 PCICRBit = 3
#define digitalPinToPCICR(p)    (((p) >= 0 && (p) <= 31) ? (&PCICR) : ((uint8_t *)0))
#define digitalPinToPCICRbit(p) (((p) <= 7) ? 0 : (((p) <= 15) ? 1 : (((p) <= 23) ? 2 : 3)))
#define digitalPinToPCMSK(p)    (((p) <= 7) ? (&PCMSK1):(((p) <= 15) ? (&PCMSK3):(((p) <= 23) ? (&PCMSK2):(((p) <= 31) ? (&PCMSK0):((uint8_t *)0)))))
#define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) <= 15) ? ((p) - 8) : (((p) <= 23) ? ((p) - 16) : ((p) - 24))))

#ifdef ARDUINO_MAIN

// ATMEL ATMEGA1284
//
//                      +---\/---+
//          (D 0) PB0  1|        |40  PA0 (AI 0 / D24)
//          (D 1) PB1  2|        |39  PA1 (AI 1 / D25)
//INT2      (D 2) PB2  3|        |38  PA2 (AI 2 / D26)
//      PWM (D 3) PB3  4|        |37  PA3 (AI 3 / D27)
//      PWM (D 4) PB4  5|        |36  PA4 (AI 4 / D28)
//     MOSI (D 5) PB5  6|        |35  PA5 (AI 5 / D29)
//PWM  MISO (D 6) PB6  7|        |34  PA6 (AI 6 / D30)
//PWM   SCK (D 7) PB7  8|        |33  PA7 (AI 7 / D31)
//                RST  9|        |32  AREF
//                VCC 10|        |31  GND
//                GND 11|        |30  AVCC
//              XTAL2 12|        |29  PC7 (D 23)
//              XTAL1 13|        |28  PC6 (D 22)
//     RX0 (D 8)  PD0 14|        |27  PC5 (D 21) TDI
//     TX0 (D 9)  PD1 15|        |26  PC4 (D 20) TDO
//INT0 RX1 (D 10) PD2 16|        |25  PC3 (D 19) TMS
//INT1 TX1 (D 11) PD3 17|        |24  PC2 (D 18) TCK
//     PWM (D 12) PD4 18|        |23  PC1 (D 17) SDA
//     PWM (D 13) PD5 19|        |22  PC0 (D 16) SCL
//     PWM (D 14) PD6 20|        |21  PD7 (D 15) PWM
//                      +--------+
//

// these arrays map port names (e.g. port B) to the
// appropriate addresses for various functions (e.g. reading
// and writing)
const uint16_t PROGMEM port_to_mode_PGM[] = {
NOT_A_PORT,
(uint16_t) &DDRA,
(uint16_t) &DDRB,
(uint16_t) &DDRC,
(uint16_t) &DDRD,
};

const uint16_t PROGMEM port_to_output_PGM[] = {
NOT_A_PORT,
(uint16_t) &PORTA,
(uint16_t) &PORTB,
(uint16_t) &PORTC,
(uint16_t) &PORTD,
};

const uint16_t PROGMEM port_to_input_PGM[] = {
NOT_A_PORT,
(uint16_t) &PINA,
(uint16_t) &PINB,
(uint16_t) &PINC,
(uint16_t) &PIND,
};

const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
// PORTLIST
// -------------------------------------------
PB, // PB 0 **  0 ** D  0
PB, // PB 1 **  1 ** D  1
PB, // PB 2 **  2 ** D  2
PB, // PB 3 **  3 ** D  3 PWM
PB, // PB 4 **  4 ** D  4 PWM SS
PB, // PB 5 **  5 ** D  5 MOSI
PB, // PB 6 **  6 ** D  6 MISO
PB, // PB 7 **  7 ** D  7 SCK
PD, // PD 0 **  8 ** D  8 RX0
PD, // PD 1 **  9 ** D  9 TX0
PD, // PD 2 ** 10 ** D 10 RX1
PD, // PD 3 ** 11 ** D 11 TX1
PD, // PD 4 ** 12 ** D 12 PWM
PD, // PD 5 ** 13 ** D 13 PWM
PD, // PD 6 ** 14 ** D 14 PWM
PD, // PD 7 ** 15 ** D 15 PWM
PC, // PC 0 ** 16 ** D 16 SCL
PC, // PC 1 ** 17 ** D 17 SDA
PC, // PC 2 ** 18 ** D 18 TCK
PC, // PC 3 ** 19 ** D 19 TMS
PC, // PC 4 ** 20 ** D 20 TDO
PC, // PC 5 ** 21 ** D 21 TDI
PC, // PC 6 ** 22 ** D 22
PC, // PC 7 ** 23 ** D 23
PA, // PA 0 ** 24 ** D 24 AI 0
PA, // PA 1 ** 25 ** D 25 AI 1
PA, // PA 2 ** 26 ** D 26 AI 2
PA, // PA 3 ** 27 ** D 27 AI 3
PA, // PA 4 ** 28 ** D 28 AI 4
PA, // PA 5 ** 29 ** D 29 AI 5
PA, // PA 6 ** 30 ** D 30 AI 6
PA  // PA 7 ** 31 ** D 31 AI 7
};

const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] =
{
_BV(0), /*  0, PB0 */
_BV(1), /*  1, PB1 */
_BV(2), /*  2, PB2 */
_BV(3), /*  3, PB3 */
_BV(4), /*  4, PB4 */
_BV(5), /*  5, PB5 */
_BV(6), /*  6, PB6 */
_BV(7), /*  7, PB7 */
_BV(0), /*  8, PD0 */
_BV(1), /*  9, PD1 */
_BV(2), /* 10, PD2 */
_BV(3), /* 11, PD3 */
_BV(4), /* 12, PD4 */
_BV(5), /* 13, PD5 */
_BV(6), /* 14, PD6 */
_BV(7), /* 15, PD7 */
_BV(0), /* 16, PC0 */
_BV(1), /* 17, PC1 */
_BV(2), /* 18, PC2 */
_BV(3), /* 19, PC3 */
_BV(4), /* 20, PC4 */
_BV(5), /* 21, PC5 */
_BV(6), /* 22, PC6 */
_BV(7), /* 23, PC7 */
_BV(0), /* 24, PA0 */
_BV(1), /* 25, PA1 */
_BV(2), /* 26, PA2 */
_BV(3), /* 27, PA3 */
_BV(4), /* 28, PA4 */
_BV(5), /* 29, PA5 */
_BV(6), /* 30, PA6 */
_BV(7)  /* 31, PA7 */
};

const uint8_t PROGMEM digital_pin_to_timer_PGM[] =
{
NOT_ON_TIMER, /* 0  - PB0 */
NOT_ON_TIMER, /* 1  - PB1 */
NOT_ON_TIMER, /* 2  - PB2 */
TIMER0A, /* 3  - PB3 */
TIMER0B, /* 4  - PB4 */
NOT_ON_TIMER, /* 5  - PB5 */
TIMER3A, /* 6  - PB6 */
TIMER3B, /* 7  - PB7 */
NOT_ON_TIMER, /* 8  - PD0 */
NOT_ON_TIMER, /* 9  - PD1 */
NOT_ON_TIMER, /* 10 - PD2 */
NOT_ON_TIMER, /* 11 - PD3 */
TIMER1B, /* 12 - PD4 */
TIMER1A, /* 13 - PD5 */
TIMER2B, /* 14 - PD6 */
TIMER2A, /* 15 - PD7 */
NOT_ON_TIMER, /* 16 - PC0 */
NOT_ON_TIMER, /* 17 - PC1 */
NOT_ON_TIMER, /* 18 - PC2 */
NOT_ON_TIMER, /* 19 - PC3 */
NOT_ON_TIMER, /* 20 - PC4 */
NOT_ON_TIMER, /* 21 - PC5 */
NOT_ON_TIMER, /* 22 - PC6 */
NOT_ON_TIMER, /* 23 - PC7 */
NOT_ON_TIMER, /* 24 - PA0 */
NOT_ON_TIMER, /* 25 - PA1 */
NOT_ON_TIMER, /* 26 - PA2 */
NOT_ON_TIMER, /* 27 - PA3 */
NOT_ON_TIMER, /* 28 - PA4 */
NOT_ON_TIMER, /* 29 - PA5 */
NOT_ON_TIMER, /* 30 - PA6 */
NOT_ON_TIMER /* 31 - PA7 */
};

#endif

#endif

And I added the two lines for Atmega1284 to wiring_analog.c
Code:
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
if (pin >= 54) pin -= 54; // allow for channel or pin numbers
#elif defined(__AVR_ATmega1284P__)
if (pin >= 24) pin -= 24; // allow for channel or pin numbers
#else
if (pin >= 14) pin -= 14; // allow for channel or pin numbers
#endif

And two lines to wiring_private.h
Code:
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define EXTERNAL_NUM_INTERRUPTS 8
#elif defined(__AVR_ATmega1284P__)
#define EXTERNAL_NUM_INTERRUPTS 3
#else
#define EXTERNAL_NUM_INTERRUPTS 2
#endif
13  Community / Exhibition / Gallery / Re: 3D printed Automated cat food dispenser on: August 30, 2011, 02:05:17 am
I like it. It also can be used for aquarium fish feeding.
14  Using Arduino / Programming Questions / Re: lcd keypad menu newbiee on: August 30, 2011, 01:29:40 am
Your code navigates within the menus but it completes navigation and immediately returns the main menu. Put long delays and see what happens. You should put loops in "menuOptionSelect" and "menuModeSelect" functions and get key codes.
15  Using Arduino / Programming Questions / Re: lcd keypad menu newbiee on: August 30, 2011, 12:50:55 am
Did you test your detectKey() function? Does it return the key presses correctly? May something wrong with your wiring.
Pages: [1] 2 3 ... 6