ChatGPT writes programs too.

SergiusPaulus

Active Member
Messages
597
Or rather it can find code at this point. Can it create a new program does anyone know?

can you write assembly code for mc68hc05?


Yes, I can provide an example of assembly code for the MC68HC05 microcontroller. Here's a simple program that toggles an output pin on and off:
vbnet

Copy code
ORG $8000 ; start address

RESET:
LDA #%00000001 ; load binary value 00000001 into accumulator A
STA DDRB ; set data direction register B to output
CLR PORTB ; clear port B to turn off output

LOOP:
LDA PORTB ; load current value of port B into accumulator A
EOR #1 ; XOR with binary value 00000001 to toggle the LSB
STA PORTB ; store the result back to port B
BRA LOOP ; branch back to LOOP label to repeat the process

END ; end of program
This program first sets up the data direction register (DDRB) for port B as an output and clears the output by writing 0 to the port. It then enters an infinite loop where it toggles the least significant bit (LSB) of the port B output by XORing it with binary value 00000001 and writing the result back to the port. This causes the output pin to toggle on and off.
Note that this is just a simple example and you would need to modify the code to suit your specific application.
 

Num7

Administrator
Staff
Messages
12,448
Very impressive indeed!

I asked it to write a program using Python. Took a chance, asking it to use the Pygame library. And it did:
Can you write a short python program, using pygame, that features a pixel moving randomly inside a 10x10 pixel area?

It wrote the whole thing. I don't have Python and Pygame installed right now so I can't test it, but overall, the code seems fully functional to me. It even included proper comments for every block of code along the way. I'm baffled. :oops::geek:
 

Khaos

where the wild things are
Messages
1,101
ChatGPT does lots of things

I was asking it last night to give me lyrics to songs involving various things. I checked verses with Google and found these songs are completely original and have never been produced. I have a Minecraft Animation youtube channel. I was asking it tonight to tell me animation ideas involving various Minecraft characters. The results were hilarious
 

steven chiverton

Senior Member
Messages
3,964
chat gpt is getting slow at responding and asking for some crunchy chicken recipes it gives them but not all 6 recipes i asked it for and one recipe it gave 2 ingredients before it stopped and i didn't even hit the stop generate response button so its having errors and faults but apologises for that , its apologetic for not giving me complete recipes to and it takes ages to answer and even complete some recipes
 

Num7

Administrator
Staff
Messages
12,448
Free accounts are low priority. Most of the time it works fine, but sometimes it gets pretty slow. Gotta give it a chance.

Maybe try again later. Should get back to normal soon.
 

Top