ELECTRONICS AND MATHEMATICS

COME ON MEET A PERSON WHO DIFFERS


FEBRUARY 2009 - THE PIC COMPUTER

I went to Serbia on February 15'th where I left all my computers and there I found back to my beloved PIC18F4550. I had a vision about a simple computer system and then I implemented it in Ruma. Somehow I was too lazy to read about the internal interrupt structure of the PIC 18F4550 and then I implemented my own interrupt structure with simple 74xx components.

 

First I had my PS2 Keyboard connected to the PIC system and somehow I had in my mind that an interrupt structure with those LS TTL devices (7400) would be a solution for the combination of fast interrupt measurments and a keyboard that is connected to the same interrupt. First problems occured and my work desk looked like a mess :

As I implemented the interrupt source selection with  two OR gatters and with one AND gatter then the problem occured - the signal of the keyboard - it was to weak to trigger the interrupt in the PIC18F4550.

  

I recorded the signal of the keyboard with the interrupt selection (left) and the signal withot the interrupt selection (right), because I thought that I would have eventally a time problem and that those LS TTL gatters would be too slow. Then as I saw that there was no time problem I reallized that only the amplitudes of those gatters were too small - they didn' triggered. So I took six 74LS14N Schmitt triggers and I amplified the signal so that the controller was showing a reaction.

Then I implemented on February 18'th 2009 then JK latch with wich I could select the interrupt source automatically as well as manually.

The schematic of the controller - I allways modified it somehow. I allways had in my mind that I could select several interrupt sources with that way.

IF YOU WANT TO SEE THE SCHEMATICS OF THE COMPUTER THEN

CONTACT ME ON MY E - MAIL ADRESS :

dukapaja@yahoo.com

It was in the evening as I implemented then my first keyboard command and as I was pressing the F1 key the interrupt was switching then to the fast measurment and the keyboard was switched off.

 

A serial memory expansion

19.2.2009 :

I made today my first multiprocessing application - the PIC18F4550 that was programmed with MCC from MICROCHIP and the 18F452 that was programmed with MICROBASIC from MICROELECTRONICA.

 

On the picture you can see the QL200 in the background. It was connected with the DIARY LOGGER that you see in the front with RS232. The purpose of the QL200 was to store down Data onto a SD-card and to send back data to the 18F4550 DIARY LOGGER. First I had problems with the serial communication as I didn't remarked that I was forgetting to pull the power switch on the QL200 and then I took my oscilloscope probe and I was succeeding to watch a serial signal between the 18F4550 and the QL200 :

I sent ss through the terminal program from MICROBASIC and there it was - the PIC was communcicating well. and here the software for storing down FAT structures onto the QL200 board :

program Mmc_Fat16_Test

dim fat_txt as STRING[20]                     ' "FAT16 not found",
    file_contents as STRING[50]               '"XX MMC/SD FAT16 library by Anton Rieckert\n"
    filename as STRING[14]                    '"MIKRO00xTXT"
    caracter, loop_, loop2 as byte
    i, size as dword
    Buffer as STRING[512]

'-------------- Writes string to USART
sub procedure i_Write_Str(dim byref ostr as byte[1])
  dim i as byte

  i = 0
  while (ostr[i] <> 0)
    USART_Write(ostr[i])
    Inc(i)
  wend
  USART_Write(0x0A)
end sub

'-------------- Creates new file and writes some data to it
sub procedure M_Create_New_File()

    filename[7] = "A"
    Mmc_Fat_Assign(filename, 0xA0)
    Mmc_Fat_Rewrite()                            ' To clear file and start with new data

        Mmc_Fat_Write(file_contents, 50)         ' write data to the assigned file
        USART_Write(".")

end sub

'-------------- Creates many new files and writes data to them
sub procedure M_Create_Multiple_Files()

  for loop2 = "B" to "Z"
    USART_Write(loop2)
    filename[7] = loop2              ' set filename
    Mmc_Fat_Assign(filename, 0xA0)   ' find existing file or create a new one
    Mmc_Fat_Rewrite()                 ' To clear file and start with new data
      for loop_ = 1 to 44
        file_contents[0] = loop_ div 10 + 48
        file_contents[1] = loop_ mod 10 + 48
        Mmc_Fat_Write(file_contents, 42) ' write data to the assigned file
      next loop_
  next loop2
end sub

'-------------- Opens an existing file and rewrites it
sub procedure M_Open_File_Rewrite()

    filename[7] = "C"
    Mmc_Fat_Assign(filename, 0)
    Mmc_Fat_Rewrite()
    for loop_ = 1 to 55
      file_contents[0] = loop_ div 10 + 64
      file_contents[1] = loop_ mod 10 + 64
      Mmc_Fat_Write(file_contents, 42) ' write data to the assigned file
    next loop_
end sub

'-------------- Opens an existing file and appends data to it
'               (and alters the date/time stamp)
sub procedure M_Open_File_Append()

     filename[7] = "A"
     Mmc_Fat_Assign(filename, 0)
     Mmc_Fat_Set_File_Date(2008,12,8,10,33,30)
     Mmc_Fat_Append()                                    ' Prepare file for append
     Mmc_Fat_Write(" for Si Ding Loc            ", 27)   ' Write data to assigned file
end sub

'-------------- Opens an existing file, reads data from it and puts it to USART
sub procedure M_Open_File_Read()

  filename[7] = "B"
  Mmc_Fat_Assign(filename, 0)
  Mmc_Fat_Reset(size)            ' To read file, sub procedure returns size of file
  for i = 1 to size
    Mmc_Fat_Read(caracter)
    USART_Write(caracter)         ' Write data to USART
  next i
end sub

'-------------- Deletes a file. If file esn't exist, it will first be created
'               and then deleted.
sub procedure M_Delete_File()

  filename[7] = "F"
  Mmc_Fat_Assign(filename, 0)
  Mmc_Fat_Delete()
end sub

'-------------- Tests whether file exists, and if so sends its creation date
'               and file size via USART
sub procedure M_Test_File_Exist()

dim fsize as dword
    year  as word
    month_, day, hour_, minute_ as byte
    outstr as STRING[12]

    filename[7] = "B"       'uncomment this line to search for file that ES exists
'   filename[7] = 'F'       'uncomment this line to search for file that ES NOT exist
  if (Mmc_Fat_Assign(filename, 0)) then
    '--- file has been found - get its date
    Mmc_Fat_Get_File_Date(year, month_, day, hour_, minute_)
    WordToStr(year, outstr)
    i_Write_Str(outstr)
    ByteToStr(month_, outstr)
    I_Write_Str(outstr)
    WordToStr(day, outstr)
    I_Write_Str(outstr)
    WordToStr(hour_, outstr)
    I_Write_Str(outstr)
    WordToStr(minute_, outstr)
    I_Write_Str(outstr)
    '--- get file size
    fsize = Mmc_Fat_Get_File_Size()
    LongintToStr(fsize, outstr)
    I_Write_Str(outstr)
  else
    '--- file was not found - signal it
    USART_Write(0x55)
    Delay_ms(1000)
    USART_Write(0x55)
  end if
end sub

'-------------- Tries to create a swap file, whose size will be at least 100
'               sectors (see Help for details)
sub procedure M_Create_Swap_File()
dim i as word

  for i=0 to 511
    Buffer[i] = i
  next i
  size = Mmc_Fat_Get_Swap_File(5000, "MIKROE.TXT", 0x20)   ' see help on this function for details

  if (size) then
    LongintToStr(size, fat_txt)
    I_Write_Str(fat_txt)
    for i=0 to 4999
      Mmc_Write_Sector(size, Buffer)
      Inc(size)
      USART_Write(".")
    next i
  end if
end sub

'-------------- Main. Uncomment the function(s) to test the desired operation(s)
main:
     fat_txt = "FAT16 not found"
     file_contents = "DJUKANOVIC PAVLE 08.12.2008 DIARY LOGGER \n"
     filename = "TEXTD00xTXT"
     '--- prepare PORTB for signalling
     ADCON1 = 0x3F  'set all as Digital
     PORTB = 0
     TRISB = 0
     TRISD = 0
     '--- set up USART for the file read
     USART_Init(19200)
    
    'TRISCbits.TRISC7=1; // RX
    'TRISCbits.TRISC6=0; // TX
    'SPBRG = 64
    'SPBRGH = 0x02      '// 0x0271 for 48MHz -> 19200 baud
    'TXSTA = 0x24       '// TX enable BRGH=1
    'RCSTA = 0x90       '// continuous RX
    'BAUDCON = 0x08     '// BRG16 = 1
    
    
          i = 0
  Usart_Write_Text(":50 CHARACTER SCAN:" )
'Ing. Djukanovic Pavle - scan 50 characters :
     while i < 50
        caracter = 0
        if (USART_Data_Ready()) then
         caracter = USART_Read()
            if (caracter > 0) then
             file_contents[i] = caracter
             Usart_Write(caracter)
               i= i+1
            end if
          end if
        wend

     
    
     Delay_100ms()
     '--- init the FAT library
     Spi_Init_Advanced(MASTER_OSC_DIV64, DATA_SAMPLE_MIDDLE, CLK_IDLE_LOW, LOW_2_HIGH)
     ' use fat16 quick format instead of init routine if a formatting is needed

    
      if Mmc_Fat_Init(PORTD, 2) = 0 then

       ' reinitialize spi at higher speed
       'Spi_Init_Advanced(MASTER_OSC_DIV4, DATA_SAMPLE_MIDDLE, CLK_IDLE_LOW, LOW_2_HIGH)
       '--- Test start
       Usart_Write_Text(":FAT DETECTED:")
       PORTB = 0xF0
       '--- Test routines. Uncomment them one-by-one to test certain features

                 
                  Usart_Write_Text(":Start:")
                  M_Create_New_File()
                  M_Open_File_Read()
                  Usart_Write_Text(":end:")
                 


      
       'M_Create_Multiple_Files()
       'M_Open_File_Rewrite()
       M_Open_File_Append()
       'M_Delete_File()
       'M_Test_File_Exist()
       'M_Create_Swap_File()

     else
       I_Write_Str(fat_txt)
     end if
     '--- Test termination

    
     PORTB = 0x0F
end.

 

And here the SCHEMATICS of the 18F452 :

THE OLD SIEMENS 286 COMPUTER

It was on February 17'th as I disassembled the old SIEMENS 286 computer - the computer was really cool and it had a good experimetal multipin connector at the ISA bus. I tought that I could make my first experiments with that system after analysing the 8086 system in Germany.

 

Create a free website at Webs.com