-4
\$\begingroup\$

Is there any way to load a file (of extensions .bat or .HTML) into a microcontroller and make the microcontroller run the file when it is connected to a PC using UART

EDIT: thanks for information but what I mean is that Can the microcontroller load these files into the PC (not execute them) or even choppy them as a text file . The same as AngeloQ said

\$\endgroup\$
  • 1
    \$\begingroup\$ What exactly do you mean by "run the file"? .bat (shell commands for Windows) and .html (web page description) are not in any sense executable code for a PIC. \$\endgroup\$ – Dave Tweed Mar 26 '17 at 11:48
  • \$\begingroup\$ Do you mean to load files into the PIC, and once connected by UART have it upload the file to the PC and then trigger the PC to execute or open those files? \$\endgroup\$ – AngeloQ Mar 26 '17 at 11:55
  • \$\begingroup\$ Yes Angelo that what I mean exactly \$\endgroup\$ – mohamed Mar 26 '17 at 13:09
  • 5
    \$\begingroup\$ You have now completely changed the question. Closing this moving target. \$\endgroup\$ – Olin Lathrop Mar 26 '17 at 13:28
1
\$\begingroup\$

.bat, No(ish).

Assuming that .bat is a Windows batch file, it's not possible with micro controllers like a PIC, Propeller or Arduino as they'd need to be running MS Windows to successfully recognise the .bat statements. For example what would a little Cortex do with echo %result%? There isn't a VDU with graphics card connected by default. But, the ish. You could if you went with a card like a Intel's Galileo board. Those have been know to run Win 10 (recently pulled though). It becomes a semantic argument however if a board like a Galileo is a micro controller or mico computer.

.html, No (ish).

Clearly HTML files are a form of textual content description, so there is no notion of executing them. You can transfer them (as with the .bats) to the PIC, but they can't execute in the form of issuing statements for execution by the processor. But, if you mean serve them out as a web page, then yes. They are data files and any data files can be served from a PIC running web server software and a TCP/IP stack connected to some form of network. That network could be an ethernet card or a serial modem /direct serial connection. Sparkfun has an example here of this. They could even technically have Javascript embedded within them for client side execution.

{As an aside, I'm not a fan of PIC programming for the hobbyist due to the cost of the tool set, fragmented user base support and extreme complexity. The market seems to be focused more on the professional /commercial developers. Other simpler platforms are available like Arduino et. al.}

\$\endgroup\$
1
\$\begingroup\$
Is there any way to load a file (of extensions .bat or .HTML) into a microcontroller and make the microcontroller run the file when it is connected to a PC using UART

This is a nonsensical question, even if it were actually written as a question.

Microcontrollers run their native instructions. They can't run anything else. Stop and actually think about what you are asking.

BAT files are scripts, or at best interpreted code. That means there is a separate program that reads the code and performs the actions specified by that code. Normally that program is CMD.EXE running on the Windows operating system. First, no microcontroller comes with the equivalent of CMD.EXE built in somehow. Second, even if you were to try doing that yourself, you'd need to port much of Windows to the processor first. That is now clearly out of the realm of "microcontroller".

HTML files aren't even code at all. They are a description of how to display text and other information. This description is interpreted by software known as a "web browser". That's a large piece of code too. And then, microcontrollers don't come with displays built in. And even then, how do you imagine this is supposed to work across a UART link?

Your overall premises are absurd, and show that you have no idea what a microcontroller is, nor what BAT files and HTML files really are or and how they are processed on large systems. You heard some words and thought they could be magically put together somehow. It is wise to not throw around words you don't understand.

Go learn some basics of what a operating system, interpreter, and web browser are, and how computers work at the hardware level. Or start by trying to blink a LED with a microcontroller.

\$\endgroup\$
  • 1
    \$\begingroup\$ Seems like you didn't understand my question see the edit \$\endgroup\$ – mohamed Mar 26 '17 at 13:26
  • \$\begingroup\$ Actually, .bat files don't require windows at all. DOS uses COMMAND.COM to execute them in a fully text oriented user interface. I use it to play original DOOM. CMD.EXE came years /digital generations later. \$\endgroup\$ – Paul Uszak Mar 26 '17 at 21:20
  • \$\begingroup\$ @Paul: Yes, BAT files were first executed by COMMAND.COM on DOS. However, many modern BAT files use newer features that aren't supported by the old COMMAND.COM. Considering this is 2017 and the OP is already confused enough, this level of detail will just confuse more by even mentioning it. \$\endgroup\$ – Olin Lathrop Mar 26 '17 at 22:21
0
\$\begingroup\$

HTML, maybe. If you want to run a server, Microchip gives free libraries for TCP/IP connection. (Google TCP/IP Stack for PIC, however, the documentation is somewhat weak). As far as I know, batch files are specific to Windows, so you need Windows installed on your PIC, which is not possible.

\$\endgroup\$
  • \$\begingroup\$ It is likely not that difficult to port a minimalist dos to a pic giving how minimalist 8088 and 8086 are. \$\endgroup\$ – dannyf Mar 26 '17 at 12:50
  • \$\begingroup\$ > As far as I know, batch files are specific to Windows, ... probably not. \$\endgroup\$ – dannyf Mar 26 '17 at 13:38
  • \$\begingroup\$ @dannyf that would be an interesting project. Since it is not my specialty, I don't know how hard would it be. I ll check it though \$\endgroup\$ – C K Mar 26 '17 at 17:13
  • \$\begingroup\$ @dannyf wouldn't the differences between architectures when porting the kernel be more than "not that difficult"? (MIPS vs x86 - Risc vs cisc) \$\endgroup\$ – C K Mar 26 '17 at 17:19
  • 1
    \$\begingroup\$ @dannyf It would be impossible to port the .bat interpreter (COMMAND.COM) to just a PIC as it's scoped to handle storage, input & output. Non of these exist on a lone PIC. Even modern DOS (DOSBox) requires a full computer not just a PIC. You'd have to build a full blown IBM PC around a PIC CPU. I guess you could technically, but it would be hard (and interesting). \$\endgroup\$ – Paul Uszak Mar 26 '17 at 21:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.