Sunday's work- PIC 16F clocked at 32 MHz and much more

Discussion in 'The Projects Forum' started by takao21203, Feb 24, 2013.

  1. takao21203

    Thread Starter AAC Fanatic!

    Apr 28, 2012
    I guess you write a reply "You must not clock a 20 MHz PIC at 32MHz".

    I can tell you upfront that is not the issue with the project. Cycle is only 8 MHz anyway.

    And it works 100% no problems.

    I am currently making a new prototype for a 68000 computer.

    I have done away with all the things I did not like.

    For instance wire junctions are plain evil.

    Only using 8bit memory chip. The new design will latch the upper 8 bit, and it is only using 5 lower address bits directly, a shifting register for the rest.

    8K memory as for now!

    If I want a superfast system, there is no need to use a 68000. Far too much power consumption as well.

    I want to get some 68000 code actually executing no matter how.

    Made the PIC working today, added two serial displays.

    It was...

    Everything that can go wrong went wrong. From wire shorts, to swapped wires, and too high clock frequency. I had to insert delays everywhere, to resolder the serial wires, to measure each for shorts.

    It works now! And I wrote the defines for all the port bits to interface the 68000 in the morning.

    Only PORT C is left blank, basically.

    16F946 has large FLASH memory, 0x3FFF address space. About 0x0500 words are used up by the serial display code.

    Have to solder quite a few wires, and write code to test the RAM, that's the next step.

    Hope the old chip is still OK. Have others here if not.

    Including 68SEC000 + support chips + CPLD board. Somehow it has to be this old 5V technology.

    I want to see if it can work with less than 5V. Many experiments to do!

    Also wrote some definitions for the 68000 vectors, have to load some things into the RAM before starting.

    Don't tell me to use a GAL or CPLD or EPROMs and stuff like that. I have all these things here. I do not want to use it. I have hundreds of 74xx chips here, even made some proto circuits in the past for 68000. All way too many wires and a big mess to remember how it works.
  2. DickCappels


    Aug 21, 2008
    ...and what is your question?
  3. takao21203

    Thread Starter AAC Fanatic!

    Apr 28, 2012
    There are thousands of detail questions. Enough for a 50 pages document and too much for a forum post.

    Some of these have been resolved already.

    Others need a working circuit.

    For instance interfacing 5V and 3V.

    The CLPD board I have here is 3.3V based.
    From what I understand from the datasheet (It is a MAX 2 CPLD with 240 logical units), I would have to clamp inputs manually as well to add resistors.

    Or can I actually run the 68000 at less than 5V?

    What is the voltage when it essentially will stop working?

    Things like that.

    Or how to do the bridge between the 68000 software and the PIC I/O.

    I want to halt the CPU every 1mS, and test some memory addresses.

    Should I interface pheripherals directly to the 68000 or to the PIC?

    For instance I could use upper address bits.

    All signals processing will be done in software by the PIC.
    But, once I get it working, I can improve it, and I will know already what I need to program into the CPLD.

    The big question of course- how can I do away with as many ICs as possible?

    I am open to comments and suggestions, just not warning me to clock the PIC at 32 MHz. This is not relevant for now and this is a test circuit only which does not need reliability.

    Discrete logic gates or GALs I also do not want to use. GALs have been discontinued. Even if I have 20 or 30 pcs. here, have programmed a few for testing purpose.

    There are other options for instance to chain the 68000 to a STM32 board (which has a lot of I/O). It is a bit pointless since the STM32 has 170 MHz, while the 68000 has 8 MHz.

    The 8bit PIC 16f946 is a better mach here, still 5V, and 53 I/O. Have not found any 5V PICs with more I/O. Even if I have cut it down as much as I was able to, I have only PORTC left free now.

    I have also decided not to use any assembler on the PIC side. The software interface will be slow, typically resulting in 30 to 50 cycles at least for each instruction.

    Maybe I will use some assembler once it works to make it faster.

    It is for show, after all, not for performance.

    Also have a 68008 here actually only needs 8bit wide RAM.
  4. takao21203

    Thread Starter AAC Fanatic!

    Apr 28, 2012
    Only 8 wires to connect the PIC with the databus, then I can test the RAM: write patterns, and read back.

    It is still a decent wiring work, even with only 8bit RAM, and 13 address lines. I use the PIC at first to load data into the RAM.

    Then later I also use it as latch for 16bit databus, the address comes from the 68000 except A0. When I get a 16bit request, I set A0 at first, and latch that to the upper data bus bits. Then for the lower 8bit, it is provided by the RAM already.

    Added a switch to hold the 68000 in reset as the wiring is not completed.

    Questions are if this works? Added 2 510 Ohms resistors even if they are not stricly neccessary.

    I want a small LCD as well, received some Nokia 6110 a few days ago.

    I am going to make an intelligent display: Fonts, lines, pixels etc. all done by a small PIC32. Interfaced to the 68000 directly.

    Given the slow bus cycles, doing bit arithmetic would not be the right thing.

    For instance I want to compute Sierpinski triangle on the 68000.

    So a pixel write interface would be useful, without dealing with bit level deskewing.

    Other displays here but the Nokia display is so small it will fit on the board somewhere.

    Later I will also have a small keypad with serial I/O, and memory mapped through the bootloader PIC.
  5. takao21203

    Thread Starter AAC Fanatic!

    Apr 28, 2012
    Having these 8 wires in place now for the databus.
    Everything ready to test the RAM chip.

    Breaking up the design into smaller steps which all are not much complicated to wire and to test is the only solution.

    I want to test if I can lower the voltage from 5 volts and when it will stop working.

    No GALs or 74xx latches contained.

    Hope the chip still works after 26 years.
  6. takao21203

    Thread Starter AAC Fanatic!

    Apr 28, 2012
    Powered up the circuit for the first time with 68000 + RAM connected.
    Programmed a RAM test- worked instantly as it should.
    I write data to the RAM, read back, and increase the address.

    Code ( (Unknown Language)):
    1. void RAM_WRITE(unsigned int addr,unsigned char data)
    2. {unsigned int addr2;
    4.  RAM_OE=1;
    5.  addr2=addr&0xffe0;
    7.  D07_PORT_WR;
    8.  if(addr_upper==addr2)
    9.  {
    10.   AREG_OE=0;
    11.   PORTA=(unsigned char)(addr);
    12.   PORTD=data;
    13.   RAM_WR=0;
    14.   RAM_WR=1;
    15.   AREG_OE=1;
    16.  }else
    17.  {
    18.   RAM_SET_ADDR_UPPER((unsigned char)(addr2>>5));
    19.   PORTA=(unsigned char)(addr);
    20.   PORTD=data;
    21.   RAM_WR=0;
    22.   RAM_WR=1;
    23.   AREG_OE=1;
    24.   addr_upper=addr2;
    25.  }
    26. }
    28. unsigned char RAM_READ(unsigned int addr)
    29. {
    30.  unsigned int addr2;
    31.  unsigned char data;
    33.  addr2=addr&0xffe0;
    35.  D07_PORT_RD;
    36.  if(addr_upper==addr2)
    37.  {
    38.   AREG_OE=0;
    39.   PORTA=(unsigned char)(addr);
    40.   RAM_OE=0;
    41.   data=PORTD;
    42.   RAM_OE=1;
    43.   AREG_OE=1;
    44.  }else
    45.  {
    46.   RAM_SET_ADDR_UPPER((unsigned char)(addr2>>5));
    47.   AREG_OE=0;
    48.   PORTA=(unsigned char)(addr);
    49.   addr_upper=addr2;
    50.   RAM_OE=0;
    51.   data=PORTD;
    52.   RAM_OE=1;
    53.   AREG_OE=1;
    54.  }
    55.  return(data);
    56. }
    Code ( (Unknown Language)):
    1. addr=0;
    2.     data=0;
    3.     RAM_OE=1;
    4.     RAM_WR=1;
    5.     AREG_OE=1;
    6.     AREG_SHCLK=0;AREG_STCLK=0;
    8.     while(1)
    9.     {
    10.         if(v_ram_tst==0x77)
    11.         {
    12.             v_ram_tst=0;
    13.             RAM_WRITE(addr,data);
    14.             data2=RAM_READ(addr);
    15.             DEBUG_DISPLAY_UPDATE(0,addr);
    16.             DEBUG_DISPLAY_UPDATE(1,data2);
    17.             addr++;
    18.             data++;
    19.         }
    20.         if(v_led0&0x01)ICSP_LED=1;else ICSP_LED=0;
    22.     }
    This test is important since I use a 8 MHz instruction cycle on the PIC. The write enable is set (to zero) and then immediately reset. It works.

    The 68000 chip heats up a very little but is hold in reset + halt condition.

    For the upper address bits a 74hc595 shifting register is used, data via D0 from the databus. Only 32 byte banks can be addressed directly.