login

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Zap

Pages: [1]
1
Programming Questions / Re: Bi directional port in a library example?
« on: December 11, 2011, 10:28:02 PM »

I'm using the Atmeaga 128 @ 16mhz on home brewed 1v1 type of board.
 
The test sketch is attached, Note that to switch between function or lib for testing, comment out one of the first two lines in the main loop.

NB : Also I use the arduino liquidcrystal lib instead of the wiring one as I require 4 bit mode for my boards.(you could comment out anything not required for your tests)

Zap.
2
Programming Questions / Re: Bi directional port in a library example?
« on: December 07, 2011, 06:17:45 PM »
Brett , did you find anything with the files I supplied?

Thanks Zap.
3
Programming Questions / Re: Problem uploading code to Wiring hardware
« on: November 23, 2011, 06:34:05 PM »

Try the "Wiring V1.0/Wiring Mini v1.0 @ 16mhz" selection
This works for my Mega128 boards.

Zap.
4
Programming Questions / Re: Bi directional port in a library example?
« on: November 16, 2011, 08:39:29 PM »


Brett, the secon is the .lss for the function
5
Programming Questions / Re: Bi directional port in a library example?
« on: November 16, 2011, 08:38:24 PM »

Brett, previous post has wrong file and cant remove it.
And due to forum file limits here is the .lss for the Lib
6
Programming Questions / Re: Bi directional port in a library example?
« on: November 16, 2011, 06:44:03 PM »
Brett, I had trouble at first but after copying all the cyg*.dll's to the tools\bin folder I got it to dump them.

Let me know if you need anything more,

 Zap.
 
7
Programming Questions / Re: Bi directional port in a library example?
« on: November 14, 2011, 01:15:46 AM »
Yes it looks like compiler optimisation. I dug out the DSO and found a difference in the chip select timeing pulses comming out of port 1 ( PC7) in each case.

For a function in a sketch of only
  portWrite(1, 0x80);       // sets the latch for the input buffer
  portWrite(1, 0x00);        // turns off the input latch
the output pulse length is 1.56 us ( 25 clk cyc)

However for a lib call of the same (above),  the pulse length is 60-61 ns ( 1 clk cycle).

This shorter lib pulse has caused the latch not to be settled in time for the read. (there is also a PAL16V8B that does the binary to 1 of chip selection for the bus chips between the MCU and them)

I tried a 1 microsecond delay in the lib call to allow the latch to settle and this works OK as below.

  portWrite(1, 0x80);       // sets the latch for the input buffer
  delayMicroseconds(1);     // delay to let latch settle
  ipt = portRead (2);       // reads the data on the buss port
  portWrite(1, 0x00);        // turns off the input latch

Now that I know what the problem is,  how do I add a few Nop to the lib instead of the 1 us delay?

And Why is there such a big compiled difference ( 1 & 25 cycles) between the sketch and the lib?

Thanks Zap.

8
Programming Questions / Bi directional port in a library example?
« on: October 31, 2011, 11:18:30 PM »

I am useing port 2 on my DIY wiring board as a bi directional port (bus) and works fine accessing it using a sketch such as below. (port 1 is used as the chip /latch select)

// function getiptbyte gets the data byte on the input latch
byte getiptbyte (){
  portMode(2, INPUT);       // flips the bus port to input
  portWrite(1, 0x80);       // sets the latch for the input buffer
  ipt = portRead (2);       // reads the data on the buss port
  portWrite(1, 0x00);        // turns off the input latch
  portMode(2, OUTPUT);      // resets the bus port to output
  return ipt;
}

However when I try to move this into a class library (As below) it does not read the data on the bus for some reason. Is this the correct way to manipulate the portmode in a libary? and is there any example librarys with a port being used as Bi-directional?

 // member: getiptbyte gets the data byte on the input latch
byte iWire::getiptbyte (){
  portMode(2, INPUT);       // flips the bus port to input
  portWrite(1, 0x80);       // sets the latch for the input buffer
  ipt = portRead (2);       // reads the data on the buss port
  portWrite(1, 0x00);       // turns off the input latch
  portMode(2, OUTPUT);      // resets the bus port to output
//  ipt = (0xAA);           // Used only to test that the return works.
  return ipt;
}


Thanks Zap.
9
Yes I did that, however I've been doing some more investigations and I've come to the conclusion that the difference between 0027 and 0100 may in the way unused pins are 'default' setup, it may be unused pins are default as input's or maybe the internal tie downs are different by default.
 I found with the same sketch that unused pins (say 29 & 30) would be low (0v) in IDE 0027 and using IDE 0100 the same unused pins would be high (+5V.
unused = not defined in sketch at all.

Now that I know that I won't do a stupid thing like use the unused pins as current sinks.

Thanks Zap.
10

Some time ago I built up a number of atmega128 wireing boards of my own requirements and have been using a v2.x auto reset bootloader sucessfully under Wiring 0027. Firmware from here http://www.avride.com/article/wiring/ burnt using AVRstudio and a mkII isp.

I have now upgraded to Wiring 0100 IDE and have noticed that some pins do not operate as previously ( same shetch in both IDE's). Two pins in question are I/O 27 & 28 (PB3 & PB4) do not work however I/O 31 (PB7) is OK. (note not all pins tested as these boards do not use all of them)
In IDE 0100 I am useing Board / Wiring / Wiring V1.0/Wiring Mini @16mhz as this appears to be the closest choice for this hardware.

What do I need to do to use wiring IDE 0100 corectly with these boards?

Thanks Zap.
Pages: [1]