pic16f84adip18.py 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. """
  2. # TOP2049 Open Source programming suite
  3. #
  4. # Microchip PIC16F84 DIP18
  5. #
  6. # Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License along
  19. # with this program; if not, write to the Free Software Foundation, Inc.,
  20. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. """
  22. from .microchip8_splittedPMarea import *
  23. class Chip_Pic16F84adip18(microchip8_splittedPMarea):
  24. CMD_BEGIN_ERASE_PROGRAMMING_CYCLE = 0x8
  25. CMD_BEGIN_PROGRAMMING_ONLY_CYCLE = 0x18
  26. voltageVDD = 5
  27. voltageVPP = 13
  28. delayTinternalProgPM = 0.004
  29. userIDLocationSize = 4
  30. hasEEPROM = True
  31. def __init__(self):
  32. microchip8_splittedPMarea.__init__(self,
  33. chipPackage="DIP18",
  34. chipPinVCC=14,
  35. chipPinsVPP=4,
  36. chipPinGND=5,
  37. signature=b"\x60\x05",
  38. flashPageSize=0x200,
  39. flashPages=1,
  40. eepromPageSize=64,
  41. eepromPages=1,
  42. fuseBytes=2
  43. )
  44. def sendWriteFlashInstr(self):
  45. '''
  46. '''
  47. self.sendCommand(0, 0, 0, self.CMD_BEGIN_PROGRAMMING_ONLY_CYCLE)
  48. self.top.cmdDelay(self.delayTinternalProgDM)
  49. def sendWriteFlashInstrDM(self):
  50. self.sendWriteFlashInstr()
  51. def bulkErasePGM(self):
  52. self.sendCommand(0, 0, 0, self.CMD_BULK_ERASE_PGM)
  53. self.sendCommand(0, 0, 0, self.CMD_BEGIN_PROGRAMMING_ONLY_CYCLE)
  54. self.top.cmdDelay(self.delayTera) # Tera
  55. def bulkEraseDM(self):
  56. self.sendCommand(0, 0, 0, self.CMD_BULK_ERASE_DM)
  57. self.sendCommand(0, 0, 0, self.CMD_BEGIN_PROGRAMMING_ONLY_CYCLE)
  58. self.top.cmdDelay(self.delayTera) # Tera
  59. fuseDesc = (
  60. BitDescription(0, "FOSC[0], 00=LP osc, 01=XT osc"),
  61. BitDescription(1, "FOSC[1], 10=HS osc, 11=RC osc"),
  62. BitDescription(2, "WDTEN, 1=WDT enabled"),
  63. BitDescription(3, "nPWRT"),
  64. BitDescription(4, "nCP"),
  65. BitDescription(5, "nCP"),
  66. BitDescription(6, "nCP"),
  67. BitDescription(7, "nCP"),
  68. BitDescription(8, "nCP"),
  69. BitDescription(9, "nCP"),
  70. BitDescription(10, "nCP"),
  71. BitDescription(11, "nCP"),
  72. BitDescription(12, "nCP"),
  73. BitDescription(13, "nCP"),
  74. )
  75. ChipDescription(
  76. Chip_Pic16F84adip18,
  77. bitfile="microchip01dip18",
  78. chipID="pic16f84adip18",
  79. runtimeID=(0xDE04, 0x01),
  80. chipVendors="Microchip",
  81. description="PIC16F84A, PIC16LF84A",
  82. packages=(("DIP18", ""),),
  83. fuseDesc=fuseDesc,
  84. maintainer="Pavel Stemberk <stemberk@gmail.com>",
  85. )