This is an Example of implementing a custom Zpuino Soft Processor core in Papilio Pro FPGA i.e.e Xilinx Spartan 6 LX9. The HC-SR 06 Serial Bluetooth Module is connected to two pins of the FPGA, which are defined during designing the custom Zpuino Core in Xilinx. The Serial Port is attached to the wishbone slot of the Zpuino Soft processor core, which can be reconfigured in Xilinx.

This is an Example of implementing a custom Zpuino Soft Processor core in Papilio Pro FPGA i.e.e Xilinx Spartan 6 LX9. The HC-SR 06 Serial Bluetooth Module is connected to two pins of the FPGA, which are defined during designing the custom Zpuino Core in Xilinx. The Serial Port is attached to the wishbone slot of the Zpuino Soft processor core, which can be reconfigured in Xilinx.

Photo of The Robot

DesignLab Code

VHDL Code:
  1. HardwareSerial BTSerial( WishboneSlot(5) );
  2.  
  3. char c;
  4. String command;
  5.  
  6. int LED = 0;
  7. int LeftMotorEnable = 1;
  8. int LeftMotorPlus = 2;
  9. int LeftMotorMinus = 3;
  10.  
  11. int RightMotorPlus = 6;
  12. int RightMotorMinus = 5;
  13. int RightMotorEnable = 4;
  14.  
  15. void setup() {
  16. // put your setup code here, to run once:
  17. Serial.begin(9600);
  18. BTSerial.begin(9600);
  19.  
  20. pinMode(LeftMotorPlus, OUTPUT);
  21. pinMode(LeftMotorMinus, OUTPUT);
  22. pinMode(LeftMotorEnable, OUTPUT);
  23.  
  24. pinMode(RightMotorEnable, OUTPUT);
  25. pinMode(RightMotorMinus , OUTPUT);
  26. pinMode(RightMotorPlus , OUTPUT);
  27.  
  28. pinMode(LED, OUTPUT);
  29. }
  30.  
  31. void loop() {
  32.  
  33. while (BTSerial.available() > 0)
  34. {
  35. delay(1);
  36. c = BTSerial.read();
  37. command += c;
  38. }
  39.  
  40. if (command.length() > 0)
  41. {
  42. Serial.println(command);
  43. //Forward,Backward,Left,Right
  44. //HeadLightOn/HeadLightOff
  45. //TailLightOn/TailLightOff
  46. //Speed
  47.  
  48. if (command == "F")
  49. {
  50. move_forward();
  51. }
  52. if (command == "B")
  53. {
  54. move_reverse();
  55. }
  56. if (command == "L")
  57. {
  58. turn_left();
  59. }
  60. if (command == "R")
  61. {
  62. turn_right();
  63. }
  64. if (command == "S")
  65. {
  66. stop();
  67. }
  68. command = "";
  69. }
  70. delay(1);
  71. }
  72.  
  73. void move_forward() {
  74. digitalWrite(LeftMotorPlus, HIGH);
  75. digitalWrite(LeftMotorMinus, LOW);
  76. digitalWrite(LeftMotorEnable, HIGH);
  77.  
  78. digitalWrite(RightMotorPlus, LOW);
  79. digitalWrite(RightMotorMinus, HIGH);
  80. digitalWrite(RightMotorEnable, HIGH);
  81. }
  82.  
  83. void move_reverse() {
  84. digitalWrite(LeftMotorPlus, LOW);
  85. digitalWrite(LeftMotorMinus, HIGH);
  86. digitalWrite(LeftMotorEnable, HIGH);
  87.  
  88. digitalWrite(RightMotorPlus, HIGH);
  89. digitalWrite(RightMotorMinus, LOW);
  90. digitalWrite(RightMotorEnable, HIGH);
  91. }
  92. void turn_right() {
  93. digitalWrite(LeftMotorPlus, HIGH);
  94. digitalWrite(LeftMotorMinus, LOW);
  95. digitalWrite(LeftMotorEnable, HIGH);
  96.  
  97. digitalWrite(RightMotorPlus, HIGH);
  98. digitalWrite(RightMotorMinus, LOW);
  99. digitalWrite(RightMotorEnable, HIGH);
  100. }
  101. void turn_left() {
  102. digitalWrite(LeftMotorPlus, LOW);
  103. digitalWrite(LeftMotorMinus, HIGH);
  104. digitalWrite(LeftMotorEnable, HIGH);
  105.  
  106. digitalWrite(RightMotorPlus, LOW);
  107. digitalWrite(RightMotorMinus, HIGH);
  108. digitalWrite(RightMotorEnable, HIGH);
  109. }
  110. void stop() {
  111. digitalWrite(LeftMotorEnable, LOW);
  112. digitalWrite(RightMotorEnable, LOW);
  113. }